/* ASTRO STYLES - V8.0 (ZENITH SIDEBAR + CENTERED CARDS) */

/* --- 1. SETUP --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[x-cloak] { display: none !important; }

:root {
    /* Palette */
    --bg-body: #F5F7FA;
    --bg-surface: #FFFFFF;
    --text-primary: #172B4D;
    --text-secondary: #6B778C;
    --primary: #0052CC; /* Zenith Blue */
    --sidebar-bg: #091E42; /* Zenith Dark */
    --sidebar-text: #B3BAC5;
    
    /* Stati */
    --status-red: #DE350B;
    --status-yellow: #FF991F;
    --status-green: #00875A;
    
    /* Tags */
    --tag-gold-bg: #FFF9E6; --tag-gold-text: #896600;
    --tag-blue-bg: #DEECF9; --tag-blue-text: #005A9E;
    --tag-pink-bg: #FDF6F6; --tag-pink-text: #A4262C;
    --tag-vas-bg: #F3E8FF;  --tag-vas-text: #6B21A8;
    --tag-ac-bg:  #F3F4F6;  --tag-ac-text:  #374151;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex; /* Layout orizzontale per Sidebar + Main */
}

/* --- 2. SIDEBAR (Zenith Style) --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar-header {
    height: 60px; display: flex; align-items: center; padding: 0 24px;
    font-weight: 800; font-size: 20px; color: white; letter-spacing: -0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-profile {
    padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; gap: 12px;
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: white;
    display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.user-info { display: flex; flex-direction: column; }
.user-name { color: white; font-weight: 600; font-size: 14px; }
.user-role { font-size: 11px; opacity: 0.7; margin-top: 2px; }

.nav-menu { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; border-radius: 6px;
    color: var(--sidebar-text); text-decoration: none;
    font-size: 14px; font-weight: 500; margin-bottom: 4px;
    cursor: pointer; transition: all 0.2s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: var(--primary); color: white; }
.nav-counter {
    background: rgba(0,0,0,0.3); padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 700;
}

.logout-btn {
    margin: 16px; padding: 12px;
    background: rgba(255,255,255,0.05); color: #FF5630;
    border: none; border-radius: 6px; cursor: pointer;
    font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.logout-btn:hover { background: rgba(255,86,48,0.1); }

/* --- 3. MAIN AREA --- */
.main-wrapper {
    flex: 1; display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
    position: relative;
}

/* Header */
.top-bar {
    height: 60px; background: white;
    border-bottom: 1px solid #DFE1E6;
    display: flex; align-items: center; padding: 0 24px; gap: 16px;
    flex-shrink: 0;
}

/* Filtri Header */
.filter-group { display: flex; align-items: center; gap: 12px; }
.filter-select {
    background: #F4F5F7; border: none; padding: 8px 12px;
    border-radius: 4px; font-weight: 600; color: var(--text-secondary);
    font-size: 13px; cursor: pointer;
}
.filter-select:hover { background: #EBECF0; color: var(--text-primary); }
.refresh-btn {
    background: transparent; border: none; cursor: pointer;
    color: var(--primary); padding: 8px; border-radius: 4px;
    display: flex; align-items: center;
}
.refresh-btn:hover { background: #DEEBFF; }

/* Contenuto Centrale */
.content-scroll {
    flex: 1; overflow-y: auto; padding: 32px;
    display: flex; flex-direction: column; align-items: center; /* Centra le card */
}

/* --- 4. ACCORDION SECTIONS --- */
.section-wrapper {
    width: 100%; max-width: 700px; /* Non più gigante */
    margin-bottom: 16px;
}

.accordion-header {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 0; cursor: pointer; user-select: none;
    font-weight: 700; font-size: 14px; color: var(--text-primary);
    border-bottom: 2px solid transparent;
}
.accordion-header:hover { opacity: 0.8; }
.accordion-icon {
    transition: transform 0.2s; font-size: 20px; color: var(--text-secondary);
}
.accordion-header.active .accordion-icon { transform: rotate(180deg); }

/* Stati Colori Header */
.header-open { color: var(--status-red); }
.header-verify { color: var(--status-yellow); }
.header-closed { color: var(--status-green); }

/* --- 5. CARDS & INPUT --- */

/* Input Rapido (Stile Planner) */
.quick-add-box {
    background: white; border-radius: 4px;
    box-shadow: 0 1px 2px rgba(9,30,66,0.13);
    margin-bottom: 16px; overflow: hidden;
    border: 1px solid #DFE1E6;
    display: flex; align-items: center;
}
.quick-add-input {
    flex: 1; border: none; padding: 14px 16px;
    font-size: 14px; outline: none;
}
.quick-add-btn {
    background: transparent; border: none;
    color: var(--primary); font-weight: 700;
    padding: 0 16px; cursor: pointer; font-size: 13px;
}
.quick-add-btn:hover { text-decoration: underline; }

/* Card */
.task-card {
    background: white; border-radius: 6px;
    padding: 16px; margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #EBECF0;
    transition: all 0.2s; cursor: pointer;
    position: relative;
    border-left: 4px solid transparent;
}
.task-card:hover { 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); transform: translateY(-2px); 
}

/* Badges e Footer */
.card-badges { display: flex; gap: 6px; margin-bottom: 8px; }
.mini-tag { padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; }

.task-title { font-size: 15px; font-weight: 500; color: #172B4D; margin-bottom: 12px; line-height: 1.4; }

.task-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid #F4F5F7; }
.user-mini { font-size: 12px; color: #6B778C; display: flex; align-items: center; gap: 6px; }
.action-icon { font-size: 20px; cursor: pointer; color: #6B778C; transition: 0.2s; }
.action-icon:hover { color: var(--primary); transform: scale(1.1); }


/* --- 6. MODALE (Planner Style) --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(9,30,66,0.54);
    z-index: 500; display: flex; justify-content: center; align-items: center;
}
.planner-modal {
    background: white; width: 600px; max-height: 85vh;
    border-radius: 8px; display: flex; flex-direction: column;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2); overflow: hidden;
}
.modal-header { padding: 20px; border-bottom: 1px solid #DFE1E6; display: flex; justify-content: space-between; }
.modal-title-input { font-size: 20px; border: none; font-weight: 600; width: 100%; outline: none; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: #6B778C; margin-bottom: 6px; text-transform: uppercase; }
.form-input { width: 100%; padding: 8px 10px; border: 1px solid #DFE1E6; border-radius: 4px; background: #FAFBFC; font-size: 14px; }
.form-textarea { width: 100%; padding: 12px; border: 1px solid #DFE1E6; border-radius: 4px; min-height: 120px; font-family: inherit; resize: vertical; background: #FAFBFC; }
.modal-footer { padding: 16px 24px; background: #F4F5F7; border-top: 1px solid #DFE1E6; display: flex; justify-content: flex-end; gap: 12px; }
.btn-primary { background: var(--primary); color: white; border: none; padding: 8px 20px; border-radius: 4px; font-weight: 600; cursor: pointer; }
.btn-text { background: transparent; color: #42526E; border: none; font-weight: 600; cursor: pointer; }

/* Mobile Adapt */
@media (max-width: 768px) {
    .sidebar { position: fixed; transform: translateX(-100%); z-index: 200; }
    .sidebar.visible { transform: translateX(0); }
    .main-wrapper { width: 100%; }
    .content-scroll { padding: 16px; }
    .planner-modal { width: 95%; height: 90vh; }
}
