/* =====================================================
   SISTEMA DE ASISTENCIA - ESTILOS PRINCIPALES
   Estilo: Corporativo moderno, limpio, profesional
   ===================================================== */

/* --- GOOGLE FONTS --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- CSS VARIABLES --- */
:root {
    /* Colores principales */
    --c-primary: #1a56db;
    --c-primary-dark: #1340a8;
    --c-primary-light: #e8effc;
    --c-accent: #f59e0b;
    
    /* Neutros */
    --c-bg: #f3f4f6;
    --c-surface: #ffffff;
    --c-border: #e2e5ea;
    --c-border-light: #f0f1f3;
    --c-text: #1f2937;
    --c-text-secondary: #6b7280;
    --c-text-muted: #9ca3af;
    
    /* Estados */
    --c-success: #059669;
    --c-success-bg: #ecfdf5;
    --c-error: #dc2626;
    --c-error-bg: #fef2f2;
    --c-warning: #d97706;
    --c-warning-bg: #fffbeb;
    --c-info: #2563eb;
    --c-info-bg: #eff6ff;
    
    /* Tipografía */
    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    /* Espaciado */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

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

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

body {
    font-family: var(--font-body);
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); }

img { max-width: 100%; display: block; }

/* --- LOGIN PAGE --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1a56db 100%);
    padding: 1rem;
}

.login-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    animation: fadeUp 0.4s ease;
}

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

.login-card__logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card__logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--c-text);
    margin-top: 0.5rem;
}

.login-card__logo .logo-icon {
    width: 56px;
    height: 56px;
    background: var(--c-primary);
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.6rem;
    font-weight: 700;
}

.login-card__subtitle {
    text-align: center;
    color: var(--c-text-secondary);
    margin-bottom: 2rem;
    font-size: 0.93rem;
}

/* --- FORMS --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.87rem;
    color: var(--c-text);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-family: var(--font-body);
    font-size: 0.93rem;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-surface);
    color: var(--c-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.form-control::placeholder {
    color: var(--c-text-muted);
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    font-family: var(--font-body);
    font-size: 0.93rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--c-primary);
    color: white;
}
.btn-primary:hover {
    background: var(--c-primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--c-bg);
    color: var(--c-text);
    border: 1.5px solid var(--c-border);
}
.btn-secondary:hover {
    background: var(--c-border-light);
}

.btn-success { background: var(--c-success); color: white; }
.btn-success:hover { background: #047857; color: white; }

.btn-danger { background: var(--c-error); color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }

.btn-block { width: 100%; }

.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.85rem; }

/* --- FLASH MESSAGES --- */
.flash-message {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    animation: fadeUp 0.3s ease;
}

.flash-success { background: var(--c-success-bg); color: var(--c-success); border: 1px solid #a7f3d0; }
.flash-error   { background: var(--c-error-bg);   color: var(--c-error);   border: 1px solid #fecaca; }
.flash-warning { background: var(--c-warning-bg); color: var(--c-warning); border: 1px solid #fde68a; }
.flash-info    { background: var(--c-info-bg);    color: var(--c-info);    border: 1px solid #bfdbfe; }

.flash-icon { font-size: 1.1rem; flex-shrink: 0; }
.flash-close {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    flex-shrink: 0;
}
.flash-close:hover { opacity: 1; }

/* --- LAYOUT: SIDEBAR + MAIN --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #cbd5e1;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar__brand {
    padding: 1.3rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar__brand-icon {
    width: 36px;
    height: 36px;
    background: var(--c-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar__brand-text {
    font-weight: 600;
    font-size: 0.95rem;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__empresa {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 2px;
}

.sidebar__nav {
    padding: 1rem 0;
    flex: 1;
}

.sidebar__section-title {
    padding: 0.6rem 1.2rem 0.3rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 600;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1.2rem;
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar__link:hover {
    color: #f1f5f9;
    background: rgba(255,255,255,0.05);
}

.sidebar__link.active {
    color: #ffffff;
    background: rgba(26, 86, 219, 0.15);
    border-left-color: var(--c-primary);
}

.sidebar__link-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar__footer {
    padding: 1rem 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.85rem;
}

.sidebar__user-avatar {
    width: 34px;
    height: 34px;
    background: #334155;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar__user-name { color: #e2e8f0; font-weight: 500; }
.sidebar__user-role { color: #64748b; font-size: 0.75rem; }

.sidebar__logout {
    display: block;
    margin-top: 0.7rem;
    color: #ef4444;
    font-size: 0.82rem;
    font-weight: 500;
}
.sidebar__logout:hover { color: #f87171; }

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-header__title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--c-text);
}

.main-header__breadcrumb {
    font-size: 0.82rem;
    color: var(--c-text-muted);
}

.main-header__actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.main-body {
    padding: 1.5rem;
}

/* --- CARDS / STATS --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    padding: 1.3rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--c-border-light);
    transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }

.stat-card__label {
    font-size: 0.82rem;
    color: var(--c-text-secondary);
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.stat-card__value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--c-text);
    line-height: 1.2;
}

.stat-card__icon {
    float: right;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-card__icon--blue   { background: var(--c-primary-light); color: var(--c-primary); }
.stat-card__icon--green  { background: var(--c-success-bg);    color: var(--c-success); }
.stat-card__icon--orange { background: var(--c-warning-bg);    color: var(--c-warning); }
.stat-card__icon--red    { background: var(--c-error-bg);      color: var(--c-error); }

/* --- TABLES --- */
.table-container {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--c-border-light);
    overflow: hidden;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--c-border-light);
    flex-wrap: wrap;
    gap: 0.7rem;
}

.table-header__title {
    font-size: 1rem;
    font-weight: 600;
}

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

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--c-text-secondary);
    background: #f9fafb;
    border-bottom: 1px solid var(--c-border);
}

.data-table td {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--c-border-light);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }

/* --- BADGES --- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
}
.badge-success { background: var(--c-success-bg); color: var(--c-success); }
.badge-danger  { background: var(--c-error-bg);   color: var(--c-error); }
.badge-warning { background: var(--c-warning-bg); color: var(--c-warning); }
.badge-info    { background: var(--c-info-bg);     color: var(--c-info); }

/* --- SEARCH INPUT --- */
.search-input {
    position: relative;
}
.search-input input {
    padding-left: 2.2rem;
}
.search-input::before {
    content: '🔍';
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
}

/* --- MOBILE SIDEBAR TOGGLE --- */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--c-text);
    padding: 0.3rem;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open {
        display: block;
    }
    .sidebar-toggle {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .login-card {
        padding: 1.5rem;
    }
    .table-container {
        overflow-x: auto;
    }
    .data-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* --- UTILITIES --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.hidden { display: none !important; }
