:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --bg-app: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

body { 
    background: #f1f5f9; 
    color: var(--text-main); 
    height: 100vh; 
    overflow: hidden; 
}

.hidden { display: none !important; }

/* ================================================
   AUTH OVERLAY - PANTALLA DE LOGIN
   ================================================ */

.overlay {
    position: fixed; 
    inset: 0; 
    background: linear-gradient(135deg, var(--bg-app) 0%, #334155 100%);
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 1000;
}

.auth-card {
    background: white; 
    padding: 3rem; 
    border-radius: 1.5rem;
    width: 100%; 
    max-width: 420px; 
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 60px; 
    height: 60px; 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white; 
    border-radius: 16px; 
    display: flex;
    align-items: center; 
    justify-content: center; 
    font-weight: 800; 
    font-size: 1.5rem;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.3);
}

.auth-header h1 {
    font-size: 1.75rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-group { 
    margin-bottom: 1.5rem; 
}

.input-group label { 
    display: block; 
    font-size: 0.875rem; 
    font-weight: 600; 
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.input-group input {
    width: 100%; 
    padding: 0.875rem 1rem; 
    border: 2px solid var(--border);
    border-radius: 0.75rem; 
    outline: none; 
    transition: all 0.2s;
    font-size: 0.95rem;
    background: white;
}

.input-group input:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.1); 
}

.btn-login {
    width: 100%; 
    padding: 1rem; 
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white; 
    border: none; 
    border-radius: 0.75rem;
    font-weight: 700; 
    font-size: 1rem;
    cursor: pointer; 
    transition: all 0.3s;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.4);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -2px rgba(249, 115, 22, 0.5);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.login-footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ================================================
   LAYOUT PRINCIPAL
   ================================================ */

.app-layout { 
    display: flex; 
    height: 100vh; 
}

/* ================================================
   SIDEBAR
   ================================================ */

.sidebar {
    width: 280px; 
    background: var(--sidebar-bg); 
    color: white;
    display: flex; 
    flex-direction: column; 
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-box { 
    background: var(--primary); 
    padding: 8px 14px; 
    border-radius: 10px; 
    font-weight: bold; 
    font-size: 1.1rem;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.3);
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
}

.user-profile {
    background: rgba(255,255,255,0.08); 
    padding: 1.25rem;
    border-radius: 1rem; 
    margin-bottom: 1.5rem; 
    display: flex; 
    align-items: center; 
    gap: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s;
}

.user-profile:hover {
    background: rgba(255,255,255,0.12);
}

.avatar-container { 
    position: relative; 
}

.avatar-container img { 
    width: 48px; 
    height: 48px; 
    border-radius: 50%; 
    border: 3px solid var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.status-indicator {
    position: absolute; 
    bottom: 2px; 
    right: 2px;
    width: 12px; 
    height: 12px; 
    background: var(--success);
    border-radius: 50%; 
    border: 2px solid var(--sidebar-bg);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.user-details h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.role-badge {
    font-size: 0.65rem; 
    background: var(--primary);
    padding: 3px 10px; 
    border-radius: 6px; 
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================================
   NAVIGATION MENU
   ================================================ */

.nav-menu { 
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex; 
    align-items: center; 
    gap: 14px;
    padding: 0.875rem 1rem; 
    color: #cbd5e1; 
    text-decoration: none;
    border-radius: 0.875rem; 
    margin-bottom: 0.4rem; 
    cursor: pointer;
    transition: all 0.2s; 
    border: none; 
    background: transparent; 
    width: 100%; 
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-item:hover { 
    background: rgba(255,255,255,0.12); 
    color: white;
    transform: translateX(4px);
}

.nav-item.active { 
    background: var(--primary); 
    color: white;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.4);
}

.nav-item i { 
    font-size: 1.3rem; 
}

.sidebar-footer {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-item.logout {
    color: #ef4444;
}

.nav-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ================================================
   MAIN CONTENT
   ================================================ */

.main-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    overflow-y: auto;
    background: #f8fafc;
}

.top-bar {
    padding: 1.5rem 2rem; 
    background: white; 
    border-bottom: 1px solid var(--border);
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 10;
}

.top-bar h2 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.top-actions {
    display: flex;
    gap: 1rem;
}

.top-actions i {
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.top-actions i:hover {
    color: var(--primary);
}

.content-body { 
    padding: 2rem;
    flex: 1;
}

/* ================================================
   CARDS
   ================================================ */

.card { 
    background: white; 
    padding: 1.75rem; 
    border-radius: 1rem; 
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card h2, .card h3 {
    color: var(--text-main);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); 
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card i {
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--text-main);
    margin: 0.5rem 0;
}

.stat-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* ================================================
   TABLES
   ================================================ */

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

table tr:hover {
    background: #f8fafc;
}

table i {
    transition: all 0.2s;
}

table i:hover {
    transform: scale(1.2);
    color: var(--primary);
}

/* ================================================
   FORMS & INPUTS
   ================================================ */

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ================================================
   MODALES
   ================================================ */

.overlay.hidden {
    display: none;
}

/* Estilos para modales sobre la app */
.app-layout .overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* ================================================
   BUTTONS
   ================================================ */

button {
    cursor: pointer;
    transition: all 0.2s;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================
   BADGES
   ================================================ */

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .top-bar {
        padding: 1rem;
    }
    
    .content-body {
        padding: 1rem;
    }
    
    table {
        font-size: 0.85rem;
    }
    
    table th,
    table td {
        padding: 0.5rem;
    }
}

@media (max-width: 640px) {
    .app-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        max-height: 60vh;
    }
}

/* ================================================
   SCROLLBAR
   ================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ================================================
   UTILITIES
   ================================================ */

.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 1rem;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.gap-2 {
    gap: 1rem;
}
