/* SPACE UI - base tokens + utilities (scoped, minimal global) */

:root{
  /* Brand */
  --space-cyan:    #22D3EE;
  --space-cyan-2:  #06B6D4;
  --space-orange:  #FB923C;
  --space-orange-2:#F97316;

  /* Dark UI */
  --space-bg:      #070A12;
  --space-panel:   rgba(255,255,255,.06);
  --space-panel2:  rgba(255,255,255,.04);
  --space-line:    rgba(255,255,255,.10);

  --space-text:    rgba(255,255,255,.92);
  --space-muted:   rgba(255,255,255,.62);

  --space-radius:  18px;
  --space-radius2: 14px;

  /* Layout */
  --space-container: 1100px;

  /* App bar height (used for safe padding) */
  --space-appbar-h: 78px;
}

/* Minimal “safe” global base (no aggressive reset) */
*{ box-sizing:border-box; }
html, body{  }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--space-bg);
  color: var(--space-text);
}

/* Utilities (optional) */
.space-container{
  max-width: var(--space-container);
  margin: 0 auto;
  padding: 0 12px;
}

/* optional layout helpers */
.space-page{
  min-height: 100%;
}

/* when appbar is shown, pages can add bottom space 
.space-has-appbar{
  padding-bottom: calc(var(--space-appbar-h) + 18px);
}*/

.space-card{
  background: var(--space-panel2);
  border: 1px solid var(--space-line);
  border-radius: var(--space-radius);
}

.space-divider{
  height:1px;
  background: rgba(255,255,255,.10);
  border:0;
}

/* buttons used across site (optional) */
.space-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius: var(--space-radius2);
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  font-weight: 950;
  font-size: 13px;
  text-decoration:none;
  cursor:pointer;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}
.space-btn:active{ transform: scale(.99); }

.space-btn--cyan{
  border-color: rgba(34,211,238,.35);
  background: linear-gradient(135deg, rgba(34,211,238,.20), rgba(34,211,238,.06));
}
.space-btn--orange{
  border-color: rgba(251,146,60,.35);
  background: linear-gradient(135deg, rgba(251,146,60,.20), rgba(251,146,60,.06));
}
.space-btn--primary{
  border-color: rgba(124,58,237,.40); /* fallback purple if used */
  background: linear-gradient(135deg, rgba(34,211,238,.95), rgba(251,146,60,.85));
  color:#071019;
}








.editor-themeBox{
  margin: 12px 14px 0;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  border-radius: 18px;
  padding: 12px;
}
.editor-themeTop{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.editor-themeTitle{ font-weight: 950; font-size: 13px; }
.editor-themeHint{ font-size: 12px; color: rgba(255,255,255,.62); }

.editor-themeRow{
  display:flex;
  gap:10px;
  overflow:auto;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.themeCardMini{
  flex: 0 0 auto;
  min-width: 150px;
  max-width: 170px;
  scroll-snap-align: start;
  text-align:left;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  padding: 10px 10px 8px;
  color:#fff;
  cursor:pointer;
}
.themeCardMini.active{
  border-color: rgba(34,211,238,.40);
  box-shadow: 0 0 0 1px rgba(34,211,238,.12), 0 0 18px rgba(34,211,238,.18);
}
.themeMiniName{ font-weight: 950; font-size: 12.5px; line-height: 1.1; }
.themeMiniCode{ margin-top: 3px; font-size: 11px; opacity:.7; }
.themeMiniSwatches{ margin-top: 9px; display:flex; gap:8px; }
.themeMiniSwatches .sw{
  width: 16px; height: 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
}
.themeMiniSwatches .sw.c{ background: rgba(34,211,238,.85); border-color: rgba(34,211,238,.25); }
.themeMiniSwatches .sw.o{ background: rgba(251,146,60,.90); border-color: rgba(251,146,60,.25); }
.editor-themeNote{ margin-top: 10px; font-size: 12px; color: rgba(255,255,255,.70); }






/* HERO RESPONSIVE */

/* =========================================
   MODULO: TOP HERO (PC: Barra / Mobile: Card)
   ========================================= */

.top-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
    margin-bottom: 48px;
}

/* --- Sinistra: Testi e Welcome --- */
.hero-welcome { 
    flex: 1; 
}
.hero-welcome h1 {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 900;
    margin: 0 0 12px 0;
    letter-spacing: -1.5px;
    color: #fff;
    line-height: 1.1;
}
.welcome-meta { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
}

.welcome-meta
 {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-direction: column;
}

.plan-pill {
    background: var(--cyan);
    color: #000;
    font-size: 11px;
    font-weight: 900;
    padding: 6px 14px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.welcome-sub { 
    color: #94a3b8; 
    font-size: 15px; 
    font-weight: 500; 
}

/* --- Destra: Widget Statistiche e Bottoni --- */
.hero-widgets {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    max-width: 100%;
}

/* Barra orizzontale stats (PC) */
.metrics-bar {
    background: linear-gradient(to right, #111827, #1e293b);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    gap: 48px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    position: relative;
}
.metric { 
    display: flex; 
    flex-direction: column; 
    gap: 6px; 
}

/* Icone metriche */
.m-icon {
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
}
.m-icon.v-cyan { color: var(--cyan); }
.m-icon.v-orange { color: var(--orange); }
.m-icon.v-purple { color: #a855f7; }
.m-icon.v-green { color: #10b981; }

.metric-val { 
    font-size: 26px; 
    font-weight: 900; 
    color: #fff; 
    line-height: 1; 
    display: flex;
    align-items: center;
}
.metric-val span { 
    font-size: 14px; 
    color: var(--cyan); 
    margin-left: 2px; 
}

.metric-label { 
    font-size: 10px; 
    font-weight: 800; 
    color: #64748b; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

/* Separatore e Stato Sistema (PC) */
.metric.system-status {
    border-left: 1px solid rgba(255,255,255,0.08);
    padding-left: 48px;
}
.status-dot { 
    width: 10px; 
    height: 10px; 
    background: #10b981; 
    border-radius: 50%; 
    box-shadow: 0 0 12px #10b981; 
    margin-right: 8px;
}

/* --- Bottoni Hero (Align-Right) --- */
.hero-actions { 
    display: flex; 
    gap: 12px; 
}
.hero-actions .btn-dash {
    padding: 0 24px;
    height: 44px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    background: var(--cyan);
    color: #000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.2);
    transition: all 0.2s;
}
.hero-actions .btn-dash:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(6, 182, 212, 0.35);
}
.hero-actions .btn-disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
    pointer-events: none; 
    border: 1px dashed var(--border-glass); 
    background: transparent; 
    color: #fff; 
    box-shadow: none; 
}

/* =========================================
   MODULO: TOP HERO - RESPONSIVE MOBILE
   ========================================= */

@media (max-width: 991px) {
    .top-hero { 
        flex-direction: column; 
        gap: 24px; 
        align-items: stretch;
        margin-bottom: 32px;
    }
    
    .welcome-meta { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 12px; 
    }
    
    .hero-widgets { 
        align-items: stretch; 
        gap: 16px; 
        width: 100%; 
    }

    /* Trasforma la barra in uno scroller orizzontale */
    .metrics-bar {
        background: none;
        border: none;
        box-shadow: none;
        padding: 0 16px 16px 16px; /* Padding bottom per l'ombra delle card */
        margin: 0 -16px; /* Allunga ai bordi dello schermo */
        overflow-x: auto;
        display: flex;
        flex-wrap: nowrap; /* Forza le card su una singola riga */
        gap: 16px;
        scrollbar-width: none; /* Nasconde la scrollbar in Firefox */
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        margin-left: 2px;
    }
    .metrics-bar::-webkit-scrollbar { 
        display: none; /* Nasconde la scrollbar in Chrome/Safari */
    }

    /* Ogni metrica diventa una vera e propria card navigabile tramite swipe */
    .metric {
        background: var(--card-bg);
        border: 1px solid var(--border-glass);
        border-radius: 20px;
        padding: 20px;
        min-width: 140px; /* Larghezza fissa per favorire lo swipe */
        flex-shrink: 0;
        scroll-snap-align: start;
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
        justify-content: space-between;
    }
    
    /* Reset dello stile "system status" su mobile per allinearlo alle altre card */
    .metric.system-status { 
        border-left: 1px solid var(--border-glass); 
        padding-left: 20px; 
    }

    /* Pulsanti Action affiancati su due colonne */
    .hero-actions { 
        display: grid; 
        grid-template-columns: 1fr 1fr; 
        gap: 12px; 
    }
    .hero-actions .btn-dash { 
        width: 100%; 
        padding: 0 10px; 
        font-size: 13px;
    }
}




    /* =========================================
       TOOLBAR FILTRI (Desktop & Mobile)
       ========================================= */
    .toolbar-filters {
        background: rgba(15, 23, 42, 0.4); /* Sfondo leggermente distaccato dal body */
        border: 1px solid var(--border-glass);
        border-radius: 16px;
        padding: 12px 16px;
        margin-bottom: 32px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .res-filters {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    /* Wrapper per posizionare le icone dentro gli input */
    .filter-group {
        position: relative;
        display: flex;
        align-items: center;
    }

    /* Icone descrittive (Calendario, Lista) */
    .filter-icon {
        position: absolute;
        left: 14px;
        width: 16px;
        height: 16px;
        color: #94a3b8;
        pointer-events: none; /* Permette il click sull'input sottostante */
        transition: color 0.2s;
    }

    /* Freccina personalizzata per la select */
    .filter-caret {
        position: absolute;
        right: 14px;
        width: 14px;
        height: 14px;
        color: #64748b;
        pointer-events: none;
    }

    /* Stile Input Condiviso */
    .res-input {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.08);
        color: #f8fafc;
        height: 42px;
        border-radius: 12px;
        padding: 0 16px 0 40px; /* Spazio a sinistra per l'icona */
        font-size: 13px;
        font-weight: 500;
        outline: none;
        cursor: pointer;
        font-family: inherit;
        transition: all 0.2s ease;
    }

    .res-input:hover {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.15);
    }

    .res-input:focus {
        border-color: var(--cyan);
        box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
    }

    /* Colora l'icona quando l'input è in focus */
    .res-input:focus + .filter-icon,
    .filter-group:focus-within .filter-icon {
        color: var(--cyan);
    }

    /* Specifiche Select */
    .filter-select {
        appearance: none;
        -webkit-appearance: none;
        padding-right: 40px; /* Spazio a destra per la freccina */
        min-width: 180px;
    }
    .filter-select option {
        background: var(--bg-dark);
        color: #fff;
    }

    /* Specifiche input Date (Nasconde l'icona orrenda nativa del browser) */
    .filter-date {
        min-width: 150px;
    }
    .filter-date::-webkit-calendar-picker-indicator {
        background: transparent;
        bottom: 0;
        color: transparent;
        cursor: pointer;
        height: auto;
        left: 0;
        position: absolute;
        right: 0;
        top: 0;
        width: auto;
    }

    /* Pulsante Reset */
    .btn-filter-reset {
        display: flex;
        align-items: center;
        gap: 6px;
        height: 42px;
        padding: 0 16px;
        border-radius: 12px;
        background: transparent;
        color: #94a3b8;
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
        border: 1px solid transparent;
        transition: all 0.2s;
        margin-left: auto; /* Su PC spinge il bottone tutto a destra */
    }

    .btn-filter-reset:hover {
        background: rgba(239, 68, 68, 0.1);
        color: #ef4444;
        border-color: rgba(239, 68, 68, 0.2);
    }

    /* --- RESPONSIVE MOBILE --- */
    @media (max-width: 768px) {
        .toolbar-filters {
            padding: 12px;
            border-radius: 14px;
        }

        .res-filters {
            overflow-x: auto;
            scrollbar-width: none; /* Firefox */
            -webkit-overflow-scrolling: touch;
        }
        .res-filters::-webkit-scrollbar { display: none; } /* Chrome/Safari */

        .filter-group { flex-shrink: 0; } /* Impedisce agli input di schiacciarsi */
        
        .btn-filter-reset {
            margin-left: 0; /* Rimuove lo spazio auto su mobile */
            border: 1px solid rgba(255,255,255,0.05); /* Rende il tasto visibile come card */
            flex-shrink: 0;
        }
    }