/* ============================================================
   INNOVER — RESPONSIVE CSS
   Mobile-first para vendedor, adaptativo para admin/operador
   ============================================================ */

/* ---- Tablet ---- */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
    .content-wrapper { padding: var(--space-lg); }
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }

    .app-content { margin-left: 0; padding-top: 60px; }
    .content-wrapper { padding: var(--space-md); }

    /* Sidebar mobile overlay */
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: var(--z-sidebar);
        width: 280px;
    }
    .sidebar.mobile-open { transform: translateX(0); }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: var(--blur-sm);
        z-index: calc(var(--z-sidebar) - 1);
    }
    .sidebar-overlay.active { display: block; }

    /* Header mobile */
    .header { left: 0 !important; }
    .header .menu-toggle { display: flex !important; }

    /* Grids */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--space-md); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }

    /* Page header */
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-actions { width: 100%; }

    /* Tables horizontais scroll */
    .table-wrapper { font-size: var(--font-size-xs); }

    /* Modal full width */
    .modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 85vh; }
    .modal-overlay { align-items: flex-end; padding: 0; }

    /* Stat cards compactos */
    .stat-card { padding: var(--space-md); }
    .stat-card .stat-value { font-size: var(--font-size-xl); }

    /* Tabs scroll */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Search full width */
    .search-box { min-width: 100%; }
    .table-toolbar { flex-direction: column; }

    /* Toast mobile */
    .toast-container { left: var(--space-md); right: var(--space-md); top: auto; bottom: var(--space-lg); }
    .toast { min-width: auto; }
}

/* ---- Small Mobile ---- */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { flex-direction: row; align-items: center; gap: var(--space-md); }
    .stat-card .stat-icon { margin-bottom: 0; }
    h1 { font-size: var(--font-size-xl); }
    h2 { font-size: var(--font-size-lg); }
    .btn { padding: 8px 16px; font-size: var(--font-size-xs); }
    .btn-lg { padding: 12px 20px; font-size: var(--font-size-sm); }
}

/* ============================================================
   VENDEDOR — Mobile-First Optimized
   ============================================================ */
.vendedor-layout {
    margin-left: 0 !important;
    padding-top: 35px;
}

.vendedor-layout .content-wrapper {
    padding: var(--space-md);
    max-width: 600px;
}

.vendedor-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: var(--z-header);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
}

.vendedor-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 500;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    text-decoration: none;
}
.vendedor-bottom-nav a i { font-size: 22px; }
.vendedor-bottom-nav a.active { color: var(--gold-primary); }
.vendedor-bottom-nav a:hover { color: var(--gold-primary); }

/* Gerente: 7 itens — nav deslizante, mostra 5 + ponta do 6º */
.vendedor-bottom-nav.gerente-nav {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-left: 0;
    padding-right: 0;
}
.vendedor-bottom-nav.gerente-nav::-webkit-scrollbar { display: none; }
.vendedor-bottom-nav.gerente-nav a {
    min-width: calc(100vw / 5.4);
    flex-shrink: 0;
    padding: 4px 2px;
    font-size: 10px;
}

/* Quick action card mobile */
.quick-action-card {
    background: var(--gold-gradient);
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-gold);
}
.quick-action-card:active { transform: scale(0.98); }
.quick-action-card h3 { font-size: var(--font-size-lg); color: var(--white); }
.quick-action-card p { font-size: var(--font-size-sm); opacity: 0.85; margin: 0; }
.quick-action-card i { font-size: 32px; opacity: 0.6; }

/* Client list mobile */
.client-list-mobile .client-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
}
.client-list-mobile .client-item:active { background: var(--bg-hover); }
.client-list-mobile .client-info h4 { font-size: var(--font-size-base); font-weight: 600; }
.client-list-mobile .client-info p { font-size: var(--font-size-xs); color: var(--text-secondary); margin: 0; }

/* ============================================================
   TV/MONITOR DASHBOARD
   ============================================================ */
.tv-layout {
    margin-left: 0 !important;
    padding-top: 0;
    background: #0A0A0A;
    color: #F5F5F7;
    min-height: 100vh;
    overflow: hidden;
}

.tv-layout .tv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
}

.tv-layout .tv-logo { height: 40px; }
.tv-layout .tv-clock { font-size: var(--font-size-2xl); font-weight: 300; letter-spacing: 0.05em; color: rgba(255,255,255,0.7); }

.tv-layout .tv-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 1fr;
    gap: var(--space-lg);
    padding: 0 var(--space-xl) var(--space-xl);
    height: calc(100vh - 100px);
}

.tv-layout .tv-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    backdrop-filter: blur(10px);
}

.tv-layout .tv-stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tv-layout .tv-stat-label {
    font-size: var(--font-size-sm);
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

/* ============================================================
   SIDEBAR + HEADER STYLES
   ============================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar-solid);
    border-right: 1px solid var(--border-color);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-logo img { height: 36px; width: auto; }
.sidebar-logo h2 { font-size: var(--font-size-md); font-weight: 700; white-space: nowrap; background: var(--gold-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.sidebar-nav { flex: 1; padding: var(--space-sm) var(--space-md); }
.sidebar-section { margin-bottom: var(--space-sm); }
.sidebar-section-title { font-size: var(--font-size-xs); font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; padding: 4px var(--space-md); }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 7px var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: var(--transition-fast);
    text-decoration: none;
    margin-bottom: 1px;
}
.sidebar-link i { font-size: 18px; width: 24px; text-align: center; }
.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-link.active { background: var(--gold-soft); color: var(--gold-primary); font-weight: 600; }

.sidebar-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
}

/* ---- Header ---- */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--bg-sidebar-solid);
    border-bottom: 1px solid var(--border-color);
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-xl);
    transition: var(--transition);
}

.header .menu-toggle {
    display: none;
    width: 40px; height: 40px;
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.header .menu-toggle:hover { background: var(--bg-hover); }

.header-left { display: flex; align-items: center; gap: var(--space-md); }
.header-right { display: flex; align-items: center; gap: var(--space-lg); }

.header .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}
.header .breadcrumb a { color: var(--text-tertiary); }
.header .breadcrumb span { color: var(--text-primary); font-weight: 600; }

/* Theme toggle */
.theme-toggle {
    width: 40px; height: 40px;
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--gold-primary); }

/* Notification bell */
.notification-bell {
    position: relative;
    width: 40px; height: 40px;
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}
.notification-bell:hover { background: var(--bg-hover); color: var(--gold-primary); }
.notification-bell .notif-count {
    position: absolute;
    top: -2px; right: -2px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--bg-sidebar-solid);
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}
.user-menu:hover { background: var(--bg-hover); }
.user-menu .user-info { text-align: right; }
.user-menu .user-name { font-size: var(--font-size-sm); font-weight: 600; color: var(--text-primary); }
.user-menu .user-role { font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: var(--space-lg);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 420px;
    padding: var(--space-2xl);
    animation: fadeInScale 0.5s ease-out;
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: var(--space-xl);
}
.login-card .login-logo img { max-height: 120px; height: auto; width: auto; max-width: 100%; object-fit: contain; margin: 0 auto var(--space-md); }
.login-card .login-logo h1 {
    font-size: var(--font-size-xl);
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-card .login-logo p { font-size: var(--font-size-sm); color: var(--text-tertiary); margin: 0; }

.login-card .form-group { margin-bottom: var(--space-md); }
.login-card .btn-primary { width: 100%; padding: 14px; font-size: var(--font-size-md); margin-top: var(--space-md); }

/* Print hiding */
@media print {
    .sidebar, .header, .vendedor-bottom-nav { display: none !important; }
    .app-content { margin-left: 0 !important; padding-top: 0 !important; }
}
