/*
Theme Name:  FSL Manager Theme
Theme URI:   https://example.com/fsl-tema
Description: Tema WordPress dedicato alla gestione FSL (Formazione Scuola Lavoro). Integra il plugin FSL Manager con un'interfaccia moderna per tutor e studenti.
Author:      FSL Manager
Version:     1.0.0
Text Domain: fsl-tema
*/

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --blu:        #1a3a6b;
  --blu-lt:     #e8f0fc;
  --blu-mid:    #2d5eac;
  --verde:      #059669;
  --verde-lt:   #d1fae5;
  --ambra:      #d97706;
  --ambra-lt:   #fef3c7;
  --rosso:      #dc2626;
  --rosso-lt:   #fee2e2;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-600:   #475569;
  --gray-800:   #1e293b;
  --white:      #ffffff;
  --sidebar-w:  260px;
  --radius:     10px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg:  0 8px 32px rgba(26,58,107,.12);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blu-mid); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ============================================================
   LAYOUT PRINCIPALE — sidebar + content
   ============================================================ */
.fsl-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ============================================================
   TOPBAR — striscia istituzionale
   ============================================================ */
.fsl-topbar {
  grid-column: 1 / -1;
  background: var(--blu);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

/* Strisce tricolori sottili in cima */
.fsl-topbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #009246 33.3%, #fff 33.3% 66.6%, #ce2b37 66.6%);
}

.fsl-topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--white);
  text-decoration: none;
}
.fsl-topbar__brand:hover { text-decoration: none; color: var(--white); }

.fsl-topbar__icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.fsl-topbar__meta {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
}

.fsl-topbar__anno {
  background: rgba(255,255,255,.12);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.fsl-topbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fsl-topbar__avatar {
  width: 34px; height: 34px;
  background: var(--blu-mid);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,.3);
}

.fsl-topbar__user-name { font-size: 13px; font-weight: 500; }

.fsl-topbar__logout {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--white);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.fsl-topbar__logout:hover { background: rgba(255,255,255,.2); text-decoration: none; color: var(--white); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.fsl-sidebar {
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 24px 0;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.fsl-sidebar__section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-400);
  padding: 16px 20px 6px;
}

.fsl-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.fsl-nav__item:hover {
  background: var(--gray-50);
  color: var(--blu);
  text-decoration: none;
}
.fsl-nav__item.active {
  background: var(--blu-lt);
  color: var(--blu);
  border-left-color: var(--blu);
  font-weight: 600;
}
.fsl-nav__icon { font-size: 16px; width: 20px; text-align: center; }

.fsl-sidebar__divider {
  height: 1px;
  background: var(--gray-200);
  margin: 12px 20px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.fsl-main {
  padding: 28px 32px;
  overflow-x: hidden;
}

.fsl-page-header {
  margin-bottom: 24px;
}
.fsl-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--blu);
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.fsl-page-subtitle {
  font-size: 13px;
  color: var(--gray-400);
}

/* ============================================================
   CARDS
   ============================================================ */
.fsl-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 22px 26px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.fsl-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--blu);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}

/* Metric cards */
.fsl-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.fsl-metric {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.fsl-metric::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--blu);
  opacity: .4;
}
.fsl-metric--verde::after { background: var(--verde); opacity: 1; }
.fsl-metric--ambra::after { background: var(--ambra); opacity: 1; }
.fsl-metric--rosso::after { background: var(--rosso); opacity: 1; }

.fsl-metric__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gray-400);
  margin-bottom: 8px;
}
.fsl-metric__value {
  font-size: 30px;
  font-weight: 800;
  color: var(--blu);
  line-height: 1;
  letter-spacing: -.03em;
}
.fsl-metric--verde .fsl-metric__value { color: var(--verde); }
.fsl-metric--ambra .fsl-metric__value { color: var(--ambra); }
.fsl-metric--rosso .fsl-metric__value { color: var(--rosso); }
.fsl-metric__sub { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.fsl-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fsl-progress__bar {
  flex: 1;
  height: 7px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}
.fsl-progress__fill {
  height: 100%;
  border-radius: 4px;
  background: var(--blu);
  transition: width .5s ease;
}
.fsl-progress__fill--ok   { background: var(--verde); }
.fsl-progress__fill--warn { background: var(--ambra); }
.fsl-progress__fill--bad  { background: var(--rosso); }
.fsl-progress__pct {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  min-width: 38px;
  text-align: right;
}

/* ============================================================
   BADGES
   ============================================================ */
.fsl-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.fsl-badge--verde  { background: var(--verde-lt);  color: #065f46; }
.fsl-badge--blu    { background: var(--blu-lt);    color: var(--blu); }
.fsl-badge--ambra  { background: var(--ambra-lt);  color: #92400e; }
.fsl-badge--rosso  { background: var(--rosso-lt);  color: #991b1b; }
.fsl-badge--grigio { background: var(--gray-100);  color: var(--gray-600); }

/* ============================================================
   BUTTONS
   ============================================================ */
.fsl-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}
.fsl-btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.fsl-btn:active { transform: translateY(0); }

.fsl-btn--primary  { background: var(--blu);     color: var(--white); }
.fsl-btn--primary:hover { background: #143060; color: var(--white); }
.fsl-btn--secondary{ background: var(--gray-100); color: var(--gray-800); }
.fsl-btn--verde    { background: var(--verde);   color: var(--white); }
.fsl-btn--verde:hover { background: #047857; color: var(--white); }
.fsl-btn--outline  { background: transparent; color: var(--blu); border: 1.5px solid var(--blu); }
.fsl-btn--sm       { padding: 5px 12px; font-size: 12px; }
.fsl-btn--full     { width: 100%; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.fsl-form-group {
  margin-bottom: 16px;
}
.fsl-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}
.fsl-label span { color: var(--rosso); margin-left: 2px; }

.fsl-input,
.fsl-select,
.fsl-textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--gray-200);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.fsl-input:focus,
.fsl-select:focus,
.fsl-textarea:focus {
  outline: none;
  border-color: var(--blu-mid);
  box-shadow: 0 0 0 3px rgba(45,94,172,.12);
}
.fsl-input::placeholder { color: var(--gray-400); }
.fsl-textarea { resize: vertical; min-height: 90px; }
.fsl-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.fsl-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.fsl-form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.fsl-form-full { grid-column: 1 / -1; }

.fsl-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-100);
}

.fsl-field-hint {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ============================================================
   TABLE
   ============================================================ */
.fsl-table-wrap { overflow-x: auto; }
.fsl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.fsl-table th {
  background: var(--gray-50);
  color: var(--blu);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px;
  border-bottom: 2px solid var(--gray-200);
  text-align: left;
  white-space: nowrap;
}
.fsl-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.fsl-table tr:last-child td { border-bottom: none; }
.fsl-table tr:hover td { background: var(--gray-50); }

/* ============================================================
   TIMELINE ATTIVITÀ
   ============================================================ */
.fsl-timeline { position: relative; padding-left: 28px; }
.fsl-timeline::before {
  content: '';
  position: absolute;
  left: 9px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--gray-200);
}
.fsl-timeline__item {
  position: relative;
  margin-bottom: 16px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  transition: border-color .15s;
}
.fsl-timeline__item:hover { border-color: #93c5fd; }
.fsl-timeline__item::before {
  content: '';
  position: absolute;
  left: -23px;
  top: 18px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--blu);
  border: 2px solid var(--white);
  box-shadow: 0 0 0 2px var(--blu);
}
.fsl-timeline__item.validato::before { background: var(--verde); box-shadow: 0 0 0 2px var(--verde); }
.fsl-timeline__date {
  font-size: 11px;
  color: var(--gray-400);
  font-weight: 600;
  margin-bottom: 4px;
}
.fsl-timeline__title { font-weight: 700; font-size: 14px; color: var(--gray-800); margin-bottom: 6px; }
.fsl-timeline__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   ORE RADIALE (studente)
   ============================================================ */
.fsl-ore-circle {
  position: relative;
  width: 120px; height: 120px;
  margin: 0 auto 16px;
}
.fsl-ore-circle svg { transform: rotate(-90deg); }
.fsl-ore-circle__track { fill: none; stroke: var(--gray-200); stroke-width: 10; }
.fsl-ore-circle__fill  { fill: none; stroke: var(--blu); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.fsl-ore-circle__fill--ok  { stroke: var(--verde); }
.fsl-ore-circle__fill--warn{ stroke: var(--ambra); }
.fsl-ore-circle__label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  color: var(--blu);
  line-height: 1;
}
.fsl-ore-circle__label small { font-size: 11px; font-weight: 500; color: var(--gray-400); }

/* ============================================================
   ALERT
   ============================================================ */
.fsl-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 16px;
  border-left: 4px solid;
}
.fsl-alert--info   { background: var(--blu-lt);   color: var(--blu);   border-color: var(--blu-mid); }
.fsl-alert--ok     { background: var(--verde-lt); color: #065f46; border-color: var(--verde); }
.fsl-alert--warn   { background: var(--ambra-lt); color: #92400e; border-color: var(--ambra); }
.fsl-alert--error  { background: var(--rosso-lt); color: #991b1b; border-color: var(--rosso); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.fsl-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blu) 0%, #2d5eac 100%);
  padding: 20px;
}
.fsl-login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px 44px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.fsl-login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.fsl-login-logo h1 { font-size: 22px; font-weight: 800; color: var(--blu); letter-spacing: -.02em; }
.fsl-login-logo p  { font-size: 13px; color: var(--gray-400); margin-top: 4px; }

/* ============================================================
   TABS
   ============================================================ */
.fsl-tabs {
  display: flex;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 22px;
  gap: 0;
}
.fsl-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-400);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.fsl-tab:hover { color: var(--blu); text-decoration: none; }
.fsl-tab.active { color: var(--blu); font-weight: 700; border-bottom-color: var(--blu); }

/* ============================================================
   COMPETENZE DOTS
   ============================================================ */
.fsl-dots { display: flex; gap: 5px; margin-top: 4px; }
.fsl-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gray-200);
}
.fsl-dot.on { background: var(--blu); }
.fsl-dot.on.verde { background: var(--verde); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.fsl-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}
.fsl-empty__icon { font-size: 40px; margin-bottom: 12px; }
.fsl-empty__title { font-size: 15px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.fsl-empty__text  { font-size: 13px; }

/* ============================================================
   MOBILE
   ============================================================ */
.fsl-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

@media (max-width: 900px) {
  .fsl-layout { grid-template-columns: 1fr; }
  .fsl-sidebar {
    position: fixed;
    left: -100%;
    top: 60px;
    height: calc(100vh - 60px);
    width: var(--sidebar-w);
    z-index: 200;
    transition: left .25s;
    box-shadow: var(--shadow-lg);
  }
  .fsl-sidebar.open { left: 0; }
  .fsl-hamburger { display: block; }
  .fsl-main { padding: 18px 16px; }
  .fsl-form-grid,
  .fsl-form-grid.cols-3 { grid-template-columns: 1fr; }
  .fsl-metrics { grid-template-columns: 1fr 1fr; }
  .fsl-topbar__anno { display: none; }
}
