/* ============================================================
   SISTEMA DE RELATÓRIO OPERACIONAL DIÁRIO - AUDIOVISUAL
   Stylesheet Principal — Design Corporativo Moderno
   ============================================================ */

/* ==================== CSS VARIABLES (LIGHT THEME) ==================== */
:root {
    /* Primary Palette — Corporate Blue */
    --primary-50:  #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    /* Neutral */
    --gray-50:  #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic */
    --success:  #059669;
    --success-light: #d1fae5;
    --warning:  #d97706;
    --warning-light: #fef3c7;
    --danger:   #dc2626;
    --danger-light: #fee2e2;
    --info:     #0284c7;
    --info-light: #e0f2fe;
    --purple:   #7c3aed;
    --purple-light: #ede9fe;
    --teal:     #0d9488;
    --teal-light: #ccfbf1;
    --orange:   #ea580c;
    --orange-light: #fff7ed;
    --indigo:   #4f46e5;
    --indigo-light: #eef2ff;

    /* Layout */
    --sidebar-w: 260px;
    --topbar-h:  64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg:  0 10px 25px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.04);
    --shadow-xl:  0 20px 40px rgba(0,0,0,.1);
    --shadow-glow: 0 0 20px rgba(59,130,246,.15);

    /* Theme Colors */
    --bg-body:      #f0f4f8;
    --bg-surface:   #ffffff;
    --bg-sidebar:   #ffffff;
    --bg-topbar:    rgba(255,255,255,.85);
    --bg-glass:     rgba(255,255,255,.72);
    --glass-border: rgba(255,255,255,.5);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted:   #94a3b8;
    --border-color: #e2e8f0;
    --hover-bg:     #f1f5f9;

    /* Transition */
    --transition: .25s cubic-bezier(.4,0,.2,1);
    --transition-slow: .4s cubic-bezier(.4,0,.2,1);
}

/* ==================== DARK THEME ==================== */
[data-theme="dark"] {
    --bg-body:      #0b1120;
    --bg-surface:   #1a2236;
    --bg-sidebar:   #111827;
    --bg-topbar:    rgba(17,24,39,.9);
    --bg-glass:     rgba(26,34,54,.75);
    --glass-border: rgba(255,255,255,.08);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:   #64748b;
    --border-color: #1e293b;
    --hover-bg:     #1e293b;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.3);
    --shadow-md:  0 4px 6px rgba(0,0,0,.3);
    --shadow-lg:  0 10px 25px rgba(0,0,0,.4);
    --shadow-xl:  0 20px 40px rgba(0,0,0,.5);
    --shadow-glow: 0 0 30px rgba(59,130,246,.2);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: .9rem; }

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--gray-600); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--gray-500); }

/* ==================== LOADING SCREEN ==================== */
.loading-screen {
    position: fixed; inset: 0;
    background: var(--primary-700);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000;
    transition: opacity .5s, visibility .5s;
}
.loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.loading-content { text-align: center; color: #fff; }
.loading-content h2 { font-size: 1.5rem; font-weight: 700; margin-top: 1.25rem; letter-spacing: .5px; }
.loading-content p { font-size: .875rem; opacity: .8; margin-top: .25rem; }

.loading-spinner {
    width: 48px; height: 48px; margin: 0 auto;
    border: 4px solid rgba(255,255,255,.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== NOTIFICATIONS ==================== */
.notification-container {
    position: fixed; top: 80px; right: 20px;
    z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
}

.notification {
    pointer-events: all;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-500);
    min-width: 320px;
    animation: notifSlideIn .4s cubic-bezier(.22,1,.36,1);
    transition: opacity .3s, transform .3s;
}
.notification.success { border-left-color: var(--success); }
.notification.warning { border-left-color: var(--warning); }
.notification.error   { border-left-color: var(--danger); }
.notification.info    { border-left-color: var(--info); }

.notification .notif-icon { font-size: 1.4rem; }
.notification.success .notif-icon { color: var(--success); }
.notification.warning .notif-icon { color: var(--warning); }
.notification.error   .notif-icon { color: var(--danger); }
.notification.info    .notif-icon { color: var(--info); }

.notification .notif-text { font-size: .875rem; font-weight: 500; color: var(--text-primary); }
.notification .notif-close {
    margin-left: auto; color: var(--text-muted); font-size: 1.1rem;
    cursor: pointer; transition: color var(--transition);
}
.notification .notif-close:hover { color: var(--text-primary); }

.notification.hide { opacity: 0; transform: translateX(120%); }

@keyframes notifSlideIn {
    from { opacity: 0; transform: translateX(100px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition), background var(--transition);
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-text h1 {
    font-size: 1.05rem; font-weight: 800; letter-spacing: .5px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-text span { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 2px; font-weight: 600; }

.sidebar-close-btn { display: none; color: var(--text-secondary); font-size: 1.25rem; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500; font-size: .9rem;
    transition: all var(--transition);
    position: relative;
}
.nav-item:hover { background: var(--hover-bg); color: var(--text-primary); }
.nav-item.active {
    background: var(--primary-50);
    color: var(--primary-700);
    font-weight: 600;
}
[data-theme="dark"] .nav-item.active {
    background: rgba(59,130,246,.12);
    color: var(--primary-400);
}
.nav-item.active::before {
    content: '';
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 24px;
    background: var(--primary-600);
    border-radius: 0 4px 4px 0;
}
.nav-item .material-icons-outlined { font-size: 1.35rem; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex; flex-direction: column; gap: 6px;
}
.sidebar-footer-info {
    display: flex; align-items: center; gap: 10px;
    color: var(--text-muted); font-size: .8rem; font-weight: 500;
}
.sidebar-footer-info .material-icons-outlined { font-size: 1rem; }

/* ==================== MAIN CONTENT ==================== */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    transition: margin var(--transition);
}

/* ==================== TOPBAR ==================== */
.topbar {
    position: sticky; top: 0;
    height: var(--topbar-h);
    background: var(--bg-topbar);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    z-index: 900;
    transition: background var(--transition);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }

.menu-btn { display: none; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition);
}
.topbar-btn:hover { background: var(--hover-bg); color: var(--text-primary); }

.topbar-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 14px;
    transition: all var(--transition);
}
.topbar-search:focus-within {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}
.topbar-search .material-icons-outlined { font-size: 1.2rem; color: var(--text-muted); }
.topbar-search input {
    border: none; outline: none; background: transparent;
    padding: 8px 0; width: 200px;
    color: var(--text-primary);
}
.topbar-search input::placeholder { color: var(--text-muted); }

/* ==================== VIEWS ==================== */
.view { display: none; padding: 28px; animation: fadeInView .4s; }
.view.active { display: block; }

@keyframes fadeInView {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==================== KPI CARDS ==================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    display: flex; align-items: center; gap: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.kpi-card::after {
    content: '';
    position: absolute; top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 50%;
    opacity: .06;
    transform: translate(20px, -20px);
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.kpi-icon-wrap {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 1.5rem;
}
.kpi-icon-wrap.blue    { background: var(--primary-100); color: var(--primary-700); }
.kpi-icon-wrap.green   { background: var(--success-light); color: var(--success); }
.kpi-icon-wrap.yellow  { background: var(--warning-light); color: var(--warning); }
.kpi-icon-wrap.purple  { background: var(--purple-light); color: var(--purple); }
.kpi-icon-wrap.teal    { background: var(--teal-light); color: var(--teal); }
.kpi-icon-wrap.orange  { background: var(--orange-light); color: var(--orange); }
.kpi-icon-wrap.indigo  { background: var(--indigo-light); color: var(--indigo); }

[data-theme="dark"] .kpi-icon-wrap.blue    { background: rgba(59,130,246,.15); }
[data-theme="dark"] .kpi-icon-wrap.green   { background: rgba(5,150,105,.15); }
[data-theme="dark"] .kpi-icon-wrap.yellow  { background: rgba(217,119,6,.15); }
[data-theme="dark"] .kpi-icon-wrap.purple  { background: rgba(124,58,237,.15); }
[data-theme="dark"] .kpi-icon-wrap.teal    { background: rgba(13,148,136,.15); }
[data-theme="dark"] .kpi-icon-wrap.orange  { background: rgba(234,88,12,.15); }
[data-theme="dark"] .kpi-icon-wrap.indigo  { background: rgba(79,70,229,.15); }

.kpi-info { display: flex; flex-direction: column; min-width: 0; }
.kpi-value { font-size: 1.5rem; font-weight: 800; line-height: 1.2; color: var(--text-primary); }
.kpi-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* ==================== CHARTS ==================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
}

.chart-card {
    padding: 24px;
    border-radius: var(--radius-lg);
    position: relative;
}
.chart-card h3 {
    display: flex; align-items: center; gap: 10px;
    font-size: .95rem; font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}
.chart-card h3 .material-icons-outlined { font-size: 1.2rem; color: var(--primary-500); }
.chart-card canvas { width: 100% !important; height: auto !important; }

.chart-empty {
    text-align: center; padding: 40px 0;
    color: var(--text-muted); font-size: .85rem; font-style: italic;
}

/* ==================== GLASS CARD ==================== */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}

/* ==================== FORM ==================== */
.registro-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-card { padding: 28px; }
.form-header { margin-bottom: 24px; }
.form-header h3 {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.1rem; font-weight: 700;
}
.form-header h3 .material-icons-outlined { color: var(--primary-500); }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { margin-bottom: 16px; }

.form-group label {
    display: flex; align-items: center; gap: 6px;
    font-size: .8rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: .5px;
}
.form-group label .material-icons-outlined { font-size: 1rem; color: var(--primary-400); }

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-group textarea { resize: vertical; min-height: 90px; }

.tempo-total-display {
    padding: 10px 14px;
    background: var(--primary-50);
    border: 1.5px solid var(--primary-200);
    border-radius: var(--radius-sm);
    font-weight: 700; font-size: 1rem;
    color: var(--primary-700);
    text-align: center;
}
[data-theme="dark"] .tempo-total-display {
    background: rgba(59,130,246,.1);
    border-color: rgba(59,130,246,.3);
    color: var(--primary-300);
}

.form-actions {
    display: flex; gap: 12px; margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600; font-size: .875rem;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn .material-icons-outlined { font-size: 1.15rem; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37,99,235,.4);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
}
.btn-secondary:hover { background: var(--hover-bg); color: var(--text-primary); border-color: var(--gray-300); }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: #fff;
}
.btn-danger:hover { opacity: .9; transform: translateY(-1px); }

.btn-sm { padding: 6px 14px; font-size: .8rem; }


/* ==================== RECENT CARD ==================== */
.recent-card {
    padding: 20px 24px;
}
.recent-card h4 {
    display: flex; align-items: center; gap: 8px;
    font-size: .9rem; font-weight: 700; margin-bottom: 14px; color: var(--text-secondary);
}
.recent-card h4 .material-icons-outlined { font-size: 1.1rem; color: var(--primary-500); }

.recent-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.recent-list li {
    padding: 10px 14px;
    background: var(--hover-bg);
    border-radius: var(--radius-sm);
    font-size: .8rem;
    color: var(--text-secondary);
    display: flex; align-items: center; gap: 8px;
    transition: background var(--transition);
}
.recent-list li:hover { background: var(--border-color); }
.recent-list .recent-time { font-weight: 700; color: var(--primary-600); min-width: 50px; }
[data-theme="dark"] .recent-list .recent-time { color: var(--primary-400); }
.empty-state-mini { justify-content: center; color: var(--text-muted) !important; font-style: italic; }

/* ==================== TABLE ==================== */
.table-card { padding: 24px; }

.table-toolbar {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.table-filters {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.filter-group input,
.filter-group select {
    padding: 7px 12px; font-size: .82rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition);
    min-width: 130px;
}
.filter-group input:focus,
.filter-group select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(59,130,246,.1);
}

.table-search {
    display: flex; align-items: center; gap: 8px;
    background: var(--hover-bg);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    transition: all var(--transition);
}
.table-search:focus-within { border-color: var(--primary-400); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.table-search .material-icons-outlined { font-size: 1.1rem; color: var(--text-muted); }
.table-search input {
    border: none; outline: none; background: transparent;
    padding: 7px 0; width: 180px; font-size: .82rem;
    color: var(--text-primary);
}

.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); }

table {
    width: 100%; border-collapse: collapse;
    font-size: .85rem;
}

thead th {
    padding: 12px 14px;
    background: var(--primary-50);
    color: var(--primary-800);
    font-weight: 700; font-size: .78rem;
    text-transform: uppercase; letter-spacing: .5px;
    text-align: left;
    border-bottom: 2px solid var(--primary-200);
    white-space: nowrap;
    position: sticky; top: 0;
}
[data-theme="dark"] thead th {
    background: rgba(59,130,246,.08);
    color: var(--primary-300);
    border-bottom-color: rgba(59,130,246,.2);
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: var(--primary-100); }
[data-theme="dark"] th.sortable:hover { background: rgba(59,130,246,.14); }
.sort-icon { font-size: .75rem; opacity: .4; margin-left: 4px; }
th.sort-asc .sort-icon,
th.sort-desc .sort-icon { opacity: 1; color: var(--primary-600); }

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition);
}
tbody tr:hover { background: var(--hover-bg); }

tbody td {
    padding: 12px 14px;
    color: var(--text-secondary);
    vertical-align: middle;
}
tbody td:first-child { font-weight: 600; color: var(--text-primary); }

.table-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 16px; padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: .82rem; color: var(--text-muted);
}

.empty-state {
    text-align: center; padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state .material-icons-outlined { font-size: 3rem; opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 1rem; font-weight: 600; }
.empty-hint { font-size: .82rem; opacity: .6; }

/* ==================== STATUS BADGES ==================== */
.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    white-space: nowrap;
}
.status-badge::before {
    content: '';
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-badge.nao-iniciada { background: var(--info-light); color: var(--info); }
.status-badge.nao-iniciada::before { background: var(--info); }

.status-badge.em-andamento { background: var(--warning-light); color: var(--warning); }
.status-badge.em-andamento::before { background: var(--warning); animation: pulse-dot 1.5s infinite; }

.status-badge.pausada { background: var(--gray-200); color: var(--gray-600); }
.status-badge.pausada::before { background: var(--gray-500); }

.status-badge.concluida { background: var(--success-light); color: var(--success); }
.status-badge.concluida::before { background: var(--success); }

.status-badge.cancelada { background: var(--danger-light); color: var(--danger); }
.status-badge.cancelada::before { background: var(--danger); }

[data-theme="dark"] .status-badge.nao-iniciada { background: rgba(2,132,199,.15); }
[data-theme="dark"] .status-badge.em-andamento { background: rgba(217,119,6,.15); }
[data-theme="dark"] .status-badge.pausada { background: rgba(100,116,139,.15); color: var(--gray-400); }
[data-theme="dark"] .status-badge.concluida { background: rgba(5,150,105,.15); }
[data-theme="dark"] .status-badge.cancelada { background: rgba(220,38,38,.15); }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%      { opacity: .3; }
}

/* ACTION BUTTONS IN TABLE */
.action-btns { display: flex; gap: 6px; }
.action-btn {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-size: 1.1rem;
}
.action-btn.edit { color: var(--primary-500); }
.action-btn.edit:hover { background: var(--primary-50); color: var(--primary-700); }
[data-theme="dark"] .action-btn.edit:hover { background: rgba(59,130,246,.15); }
.action-btn.delete { color: var(--danger); }
.action-btn.delete:hover { background: var(--danger-light); }
[data-theme="dark"] .action-btn.delete:hover { background: rgba(220,38,38,.15); }

/* ==================== REPORT ==================== */
.report-actions-top {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 16px;
    margin-bottom: 24px;
}
.report-actions-top h3 {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.1rem; font-weight: 700;
}
.report-actions-top h3 .material-icons-outlined { color: var(--primary-500); }
.report-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

.report-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    min-height: 400px;
}

.report-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 80px 20px; text-align: center;
    color: var(--text-muted);
}
.report-placeholder .material-icons-outlined { font-size: 4rem; opacity: .2; margin-bottom: 16px; }
.report-placeholder p { font-size: 1rem; }

/* Report Generated Content */
.report-section { margin-bottom: 32px; }
.report-section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 1rem; font-weight: 700;
    color: var(--primary-700);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-200);
    margin-bottom: 16px;
}
[data-theme="dark"] .report-section-title { color: var(--primary-400); border-bottom-color: rgba(59,130,246,.2); }
.report-section-title .material-icons-outlined { font-size: 1.2rem; }

.report-header {
    text-align: center; padding: 24px; margin-bottom: 28px;
    border-bottom: 2px solid var(--primary-200);
}
.report-header h2 { font-size: 1.4rem; font-weight: 800; color: var(--primary-700); margin-bottom: 4px; }
.report-header p { color: var(--text-muted); font-size: .85rem; }
[data-theme="dark"] .report-header h2 { color: var(--primary-400); }
[data-theme="dark"] .report-header { border-bottom-color: rgba(59,130,246,.2); }

.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 8px;
}
.report-kpi {
    text-align: center; padding: 16px;
    background: var(--hover-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.report-kpi-value { font-size: 1.6rem; font-weight: 800; color: var(--primary-600); }
[data-theme="dark"] .report-kpi-value { color: var(--primary-400); }
.report-kpi-label { font-size: .75rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }

.report-mini-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 8px; }
.report-mini-table th {
    text-align: left; padding: 10px 14px;
    background: var(--primary-50); color: var(--primary-700);
    font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 2px solid var(--primary-200);
}
[data-theme="dark"] .report-mini-table th { background: rgba(59,130,246,.08); color: var(--primary-300); border-bottom-color: rgba(59,130,246,.2); }
.report-mini-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-color); color: var(--text-secondary); }
.report-mini-table tr:last-child td { border-bottom: none; }

/* Timeline */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
    content: '';
    position: absolute; left: 12px; top: 0; bottom: 0;
    width: 2px; background: var(--primary-200);
    border-radius: 2px;
}
[data-theme="dark"] .timeline::before { background: rgba(59,130,246,.2); }

.timeline-item {
    position: relative; margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--hover-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.timeline-item::before {
    content: '';
    position: absolute; left: -26px; top: 16px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--primary-500);
    border: 2px solid var(--bg-surface);
}
.timeline-time { font-weight: 700; color: var(--primary-600); font-size: .85rem; }
[data-theme="dark"] .timeline-time { color: var(--primary-400); }
.timeline-desc { font-size: .85rem; color: var(--text-secondary); margin-top: 4px; }
.timeline-meta { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 5000;
    animation: modalFadeIn .25s;
}
@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    width: 90%; max-width: 520px;
    padding: 28px;
    animation: modalSlideIn .3s cubic-bezier(.22,1,.36,1);
}
.modal-sm { max-width: 400px; }
@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(.95) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.modal-header h3 {
    display: flex; align-items: center; gap: 8px;
    font-size: 1.05rem; font-weight: 700;
}
.modal-header h3 .material-icons-outlined { color: var(--primary-500); }
.modal-close {
    color: var(--text-muted); font-size: 1.2rem;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

#confirm-message { margin-bottom: 20px; color: var(--text-secondary); font-size: .9rem; line-height: 1.5; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close-btn { display: flex; }

    .main-content { margin-left: 0; }
    .menu-btn { display: flex; }

    .view { padding: 16px 12px; }
    .topbar { padding: 0 12px; height: 56px; }
    .topbar-search { display: none; }
    .topbar-title { font-size: .9rem; }

    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi-card { padding: 14px 12px; gap: 10px; }
    .kpi-value { font-size: 1.15rem; }
    .kpi-label { font-size: .68rem; }
    .kpi-icon-wrap { width: 42px; height: 42px; font-size: 1.2rem; }

    .table-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .table-filters { flex-direction: column; gap: 8px; }
    .filter-group { width: 100%; }
    .filter-group input,
    .filter-group select { min-width: 100%; width: 100%; }
    .table-search { width: 100%; }
    .table-search input { width: 100%; }
    .table-card { padding: 14px; }

    /* Make table horizontally scrollable with min-widths */
    .table-wrapper { -webkit-overflow-scrolling: touch; }
    table { min-width: 900px; }

    .report-actions-top { flex-direction: column; align-items: stretch; }
    .report-buttons { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .report-buttons .btn { justify-content: center; font-size: .75rem; padding: 10px 8px; }
    .report-content { padding: 16px 12px; }
    .report-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .report-kpi { padding: 12px 8px; }
    .report-kpi-value { font-size: 1.3rem; }

    .form-card { padding: 20px 14px; }
    .form-row { grid-template-columns: 1fr; gap: 12px; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }

    /* Bigger touch targets for mobile */
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px;
        font-size: 16px; /* prevents iOS zoom */
    }

    .btn { padding: 12px 20px; }
    .btn-sm { padding: 10px 14px; }

    .modal { width: 95%; padding: 20px; }

    /* Overlay for sidebar on mobile */
    .sidebar.open ~ .sidebar-overlay { display: block; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .kpi-card { padding: 12px 10px; gap: 8px; }
    .kpi-value { font-size: 1rem; }
    .kpi-icon-wrap { width: 36px; height: 36px; font-size: 1rem; }

    .report-kpi-grid { grid-template-columns: 1fr 1fr; }
    .report-buttons { grid-template-columns: 1fr; }

    .topbar-title { font-size: .82rem; }

    .chart-card { padding: 14px; }
    .chart-card h3 { font-size: .85rem; }

    .timeline-item { padding: 10px 12px; }
    .timeline { padding-left: 28px; }
    .timeline-item::before { left: -22px; }

    .notification { min-width: auto; width: calc(100vw - 32px); }
}

@media (max-width: 360px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .report-kpi-grid { grid-template-columns: 1fr; }
    .sidebar { width: 100%; }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    body { background: #fff !important; color: #000 !important; }
    .sidebar, .topbar, .report-actions-top, .modal-overlay,
    .notification-container, .loading-screen { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .view { display: none !important; }
    #view-relatorio { display: block !important; padding: 0 !important; }
    .report-content {
        box-shadow: none !important; border: none !important;
        background: #fff !important;
    }
    .report-section-title { color: #1d4ed8 !important; }
    .status-badge { border: 1px solid #ccc !important; }
    .timeline::before { background: #ccc !important; }
    .timeline-item::before { background: #1d4ed8 !important; }
}

/* ==================== UTILITY ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade { animation: fadeIn .4s ease; }
.animate-slide { animation: slideUp .4s cubic-bezier(.22,1,.36,1); }
