/* ============================================================================
   PLS - Modern Professional Design
   Sistema de Gestão RFID
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    /* Colors - Modern Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    
    /* Status Colors */
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --info: #3b82f6;
    --info-dark: #2563eb;
    
    /* Background - Modern Dark Theme */
    --bg-primary: #0a0e27;
    --bg-secondary: #131829;
    --bg-tertiary: #1a1f3a;
    --bg-card: rgba(19, 24, 41, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.03);
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    
    /* Borders & Effects */
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    --shadow-glow-hover: 0 0 40px rgba(99, 102, 241, 0.5);
    
    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ============================================================================
   PLS Logo Styles
   ============================================================================ */
.pls-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.pls-logo-icon {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.pls-logo-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 8px rgba(59, 130, 246, 0.3));
    transition: var(--transition);
}

.pls-logo:hover .pls-logo-icon svg {
    filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.5));
    transform: scale(1.05);
}

.pls-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e40af;
    letter-spacing: 0.05em;
    line-height: 1;
}

.pls-logo-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.pls-logo-large .pls-logo-icon {
    width: 120px;
    height: 120px;
}

.pls-logo-large .pls-logo-text {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #1e40af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pls-logo-small {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pls-logo-small .pls-logo-icon {
    width: 32px;
    height: 32px;
}

.pls-logo-small .pls-logo-text {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Logo in header/navbar */
.header .pls-logo,
.navbar .pls-logo {
    gap: 10px;
}

.header .pls-logo-icon,
.navbar .pls-logo-icon {
    width: 40px;
    height: 40px;
}

.header .pls-logo-text,
.navbar .pls-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent flash of unstyled content */
html.loading,
html.loading body {
    opacity: 0;
    overflow: hidden;
}

html.loaded,
html.loaded body {
    opacity: 1;
    transition: opacity 0.2s ease-in;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

/* Prevent flash of unstyled content */
html {
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

html.loading {
    opacity: 0;
}

/* Smooth page transitions */
.app-layout {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* Prevent layout shift during sidebar injection */
.navbar {
    transition: opacity 0.2s ease-out;
}

/* Smooth sidebar transitions */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-in-out;
}

.main-content {
    transition: opacity 0.2s ease-in-out;
}

/* ============================================================================
   SIDEBAR LAYOUT - Modern Glass Sidebar
   ============================================================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: rgba(19, 24, 41, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease-in-out;
    will-change: transform;
    transform: translateX(0); /* Default: visible on desktop */
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: none; /* Remove gradient background */
    border-radius: 0;
}

.sidebar-brand-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Remove any pseudo-element that might be creating duplicate icons */
.sidebar-brand-icon::before,
.sidebar-brand-icon::after {
    display: none !important;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-name {
    font-weight: 700;
    font-size: 1.125rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand-version {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-nav-item {
    display: block;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    border-left: 3px solid transparent;
    margin: 0.25rem 0;
}

.sidebar-nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    border-left-color: rgba(99, 102, 241, 0.5);
}

.sidebar-nav-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), transparent);
    color: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

.sidebar-nav-item i,
.sidebar-nav-item span.icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.sidebar-user-info {
    flex: 1;
}

.sidebar-user-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.sidebar-logout {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.625rem;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-logout:hover {
    background: var(--danger);
    color: white;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    background: rgba(19, 24, 41, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-header-title {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.main-header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.main-header-title p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.main-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-body {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none !important;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    margin-right: 1rem;
    transition: var(--transition);
    z-index: 1001;
    position: relative;
}

.sidebar-toggle:hover {
    background: rgba(99, 102, 241, 0.2);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    backdrop-filter: blur(4px);
}

/* Mobile and Tablet - Hide sidebar by default */
@media screen and (max-width: 1024px) {
    /* Force sidebar to be hidden - Ultra specific selectors */
    .app-layout .sidebar,
    .app-layout aside.sidebar,
    .app-layout #sidebar,
    body .sidebar,
    body aside.sidebar,
    body #sidebar,
    .sidebar:not(.open),
    aside.sidebar:not(.open),
    #sidebar:not(.open) {
        transform: translateX(-100%) !important;
        width: 280px !important;
        left: 0 !important;
    }
    
    /* Show sidebar when open */
    .sidebar.open,
    aside.sidebar.open,
    #sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
    
    /* Main content takes full width */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Show toggle button */
    .sidebar-toggle,
    button.sidebar-toggle,
    #sidebarToggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    /* Overlay hidden by default */
    .sidebar-overlay,
    #sidebarOverlay {
        display: none !important;
    }
    
    /* Show overlay when sidebar is open */
    .sidebar-overlay.open,
    #sidebarOverlay.open {
        display: block !important;
    }
    
    .main-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .main-body {
        padding: 1rem;
    }

    /* Force grids to single column on tablet */
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .sidebar,
    aside.sidebar,
    #sidebar {
        width: 260px !important;
    }
    
    .main-header {
        padding: 0.75rem;
    }
    
    .main-body {
        padding: 0.75rem;
    }
}

@media (max-width: 768px) {
    /* Force ALL grids to single column on mobile */
    .stats-grid,
    .charts-grid,
    .form-grid,
    .form-grid-main,
    .form-grid-2,
    div.stats-grid,
    div.charts-grid,
    .main-body .stats-grid,
    .main-body .charts-grid,
    .main-body div.stats-grid,
    .main-body div.charts-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Override ALL inline grid styles for mobile - Ultra specific */
    div[style*="grid-template-columns"],
    div[style*="repeat(auto-fit"],
    div[style*="repeat(auto-fill"],
    div[style*="minmax(280px"],
    div[style*="minmax(220px"],
    div[style*="minmax(250px"],
    div[style*="minmax(300px"],
    div[style*="minmax(500px"],
    div[style*="minmax(550px"],
    .main-body > div[style*="display: grid"],
    .main-body div[style*="grid-template-columns: repeat"],
    .main-body div[style*="grid-template-columns: 2fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Ensure cards don't overflow */
    .card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Stat cards for sidebar layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Charts grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(550px, 1fr));
    gap: 2rem;
}

.stat-card-compact {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card-compact:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}

.stat-card-compact .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-card-compact .stat-content {
    flex: 1;
}

.stat-card-compact .stat-label {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-card-compact .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

/* ============================================================================
   NAVBAR - Modern Glass Navigation (Legacy - for pages not using sidebar)
   ============================================================================ */

.navbar {
    background: rgba(19, 24, 41, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.navbar-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 1.25rem 2.5rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 2.5rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1.5rem;
    transition: var(--transition);
    flex-shrink: 0;
    padding: 0.5rem 0;
    position: relative;
}

.navbar-brand span {
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.navbar-brand:hover {
    transform: translateX(3px);
}

.navbar-menu {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
    justify-content: center;
    flex-wrap: nowrap;
}

.navbar-item {
    margin: 0;
    padding: 0;
}

.navbar-link {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    position: relative;
    white-space: nowrap;
    border: 1px solid transparent;
    background: transparent;
}

.navbar-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    padding: 1px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: var(--transition);
}

.navbar-link:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.navbar-link:hover::before {
    opacity: 1;
}

.navbar-link.active {
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.navbar-link.active::before {
    opacity: 1;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.625rem 1.25rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 999px;
    border: 1px solid rgba(99, 102, 241, 0.2);
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.user-info:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3), 0 4px 12px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.btn-logout {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.625rem;
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.5);
}

/* ============================================================================
   BUTTONS - Modern Button Styles
   ============================================================================ */

.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), var(--warning-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.btn-info {
    background: linear-gradient(135deg, var(--info), var(--info-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-info:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #252b47;
    border-color: var(--border-light);
}

/* ============================================================================
   CARDS & CONTAINERS - Glassmorphism Design
   ============================================================================ */

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2.5rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 2rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    opacity: 0;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
    transform: translateY(-4px);
}

.card:hover::before {
    opacity: 1;
}

.card h2, .card h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.card h2 {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card h3 {
    font-size: 1.25rem;
}

/* ============================================================================
   STATUS MESSAGES
   ============================================================================ */

.status {
    padding: 1.125rem 1.5rem;
    border-radius: 0.875rem;
    margin: 1rem 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    font-size: 0.875rem;
    backdrop-filter: blur(10px);
}

.status.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status.success::before {
    content: '✓';
    font-weight: 700;
    font-size: 1.25rem;
}

.status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status.error::before {
    content: '✕';
    font-weight: 700;
    font-size: 1.25rem;
}

.status.info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status.info::before {
    content: 'ⓘ';
    font-weight: 700;
}

.status.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.status.warning::before {
    content: '⚠';
    font-weight: 700;
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.625rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

input[type="text"]:not(.form-input),
input[type="password"]:not(.form-input),
input[type="email"]:not(.form-input),
input[type="number"]:not(.form-input),
input[type="date"]:not(.form-input),
input[type="time"]:not(.form-input),
input[type="search"]:not(.form-input),
select:not(.form-input),
textarea:not(.form-input) {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    background: rgba(19, 24, 41, 0.6);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    transition: var(--transition);
}

input:focus:not(.form-input),
select:focus:not(.form-input),
textarea:focus:not(.form-input) {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(19, 24, 41, 0.8);
}

/* ============================================================================
   TABLES - Modern Table Design
   ============================================================================ */

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(19, 24, 41, 0.6);
    backdrop-filter: blur(10px);
}

th {
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-primary);
}

tbody tr {
    transition: var(--transition);
    background: transparent;
}

tbody tr:hover {
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.01);
}

/* ============================================================================
   BADGES
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    backdrop-filter: blur(10px);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.entrada {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.saida {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.sem-fluxo {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ============================================================================
   LOADING STATES
   ============================================================================ */

.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-secondary);
    font-style: italic;
}

.spinner {
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================================
   SCROLLBAR - Modern Scrollbar
   ============================================================================ */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

.rounded { border-radius: 0.75rem; }
.rounded-lg { border-radius: 1rem; }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* ============================================================================
   MODAL - Modern Modal Design
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 2rem;
    border-top: 1px solid var(--border);
}

.form-label {
    display: block;
    margin-bottom: 0.625rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    font-size: 0.875rem;
    background: rgba(19, 24, 41, 0.6);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: rgba(19, 24, 41, 0.8);
}

.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.8125rem;
}

/* ============================================================================
   RESPONSIVE - Mobile & Tablet
   ============================================================================ */

/* Tablet and smaller desktop */
@media (max-width: 1200px) {
    .navbar-container {
        padding: 1rem 2rem;
    }
    
    .navbar-link {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
    }
    
    .container {
        padding: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .navbar-container {
        padding: 1rem 1.5rem;
        gap: 2rem;
    }
    
    .navbar-menu {
        gap: 0.375rem;
    }
    
    .navbar-link {
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .main-body {
        padding: 1.5rem;
    }
    
    .main-header {
        padding: 1rem 1.5rem;
    }
    
    .main-header-title h1 {
        font-size: 1.25rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-card-compact .stat-value {
        font-size: 1.75rem;
    }
    
    table {
        font-size: 0.8125rem;
    }
    
    th, td {
        padding: 0.875rem 0.75rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .navbar-container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }
    
    .navbar-brand {
        justify-self: start;
        font-size: 1.125rem;
    }
    
    .navbar-menu {
        width: 100%;
        justify-content: center;
        gap: 0.375rem;
        padding: 0.75rem 0;
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .navbar-menu::-webkit-scrollbar {
        height: 4px;
    }
    
    .navbar-link {
        padding: 0.625rem 0.875rem;
        font-size: 0.75rem;
        flex-shrink: 0;
    }
    
    .user-menu {
        justify-self: end;
        width: 100%;
        justify-content: space-between;
    }
    
    .user-name {
        display: none;
    }
    
    .container {
        padding: 1rem;
    }
    
    .main-body {
        padding: 1rem;
    }
    
    .main-header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .main-header-title h1 {
        font-size: 1.125rem;
    }
    
    .main-header-title p {
        font-size: 0.75rem;
    }
    
    .main-header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card-compact {
        padding: 1.25rem;
    }
    
    .stat-card-compact .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .stat-card-compact .stat-value {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 1.25rem;
        border-radius: 1rem;
    }
    
    .card h2 {
        font-size: 1.5rem;
    }
    
    .card h3 {
        font-size: 1.125rem;
    }
    
    /* Tables become scrollable on mobile */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    table {
        min-width: 600px;
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Forms */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    input[type="text"]:not(.form-input),
    input[type="password"]:not(.form-input),
    input[type="email"]:not(.form-input),
    input[type="number"]:not(.form-input),
    input[type="date"]:not(.form-input),
    input[type="time"]:not(.form-input),
    input[type="search"]:not(.form-input),
    select:not(.form-input),
    textarea:not(.form-input),
    .form-input {
        padding: 0.75rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
        width: 100%;
        justify-content: center;
    }
    
    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    /* Modal */
    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
        margin: 0.5rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.25rem;
    }
    
    .modal-header h3 {
        font-size: 1.25rem;
    }
    
    /* Badges */
    .badge {
        padding: 0.25rem 0.625rem;
        font-size: 0.6875rem;
    }
    
    /* Status messages */
    .status {
        padding: 0.875rem 1.25rem;
        font-size: 0.8125rem;
    }
}

/* Small mobile */
@media (max-width: 640px) {
    .navbar-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .navbar-link span:first-child {
        display: none;
    }
    
    .container {
        padding: 0.75rem;
    }
    
    .main-body {
        padding: 0.75rem;
    }
    
    .stats-grid {
        gap: 0.75rem;
    }
    
    .stat-card-compact {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-card-compact .stat-icon {
        width: 56px;
        height: 56px;
    }
    
    .card {
        padding: 1rem;
    }
    
    .card h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    th, td {
        padding: 0.625rem 0.375rem;
        font-size: 0.6875rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
    }
    
    .main-header-title h1 {
        font-size: 1rem;
    }
}

/* Extra small mobile */
@media (max-width: 480px) {
    .main-header-title h1 {
        font-size: 0.9375rem;
    }
    
    .stat-card-compact .stat-value {
        font-size: 1.25rem;
    }
    
    .card h2 {
        font-size: 1.125rem;
    }
    
    table {
        min-width: 500px;
    }
    
    th, td {
        padding: 0.5rem 0.25rem;
    }
    
    .modal-content {
        border-radius: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .main-body {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Utility class for responsive table wrapper */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

@media (min-width: 769px) {
    .table-wrapper {
        margin: 0;
        padding: 0;
    }
}

/* Responsive grid utilities */
@media (max-width: 768px) {
    .grid-responsive {
        grid-template-columns: 1fr !important;
    }
    
    .flex-responsive {
        flex-direction: column !important;
    }
    
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .show-mobile-only {
        display: none !important;
    }
}

/* ============================================================================
   ANIMATIONS - Smooth Animations
   ============================================================================ */

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}
