/* =====================================================
   Gestión de Notificaciones - Afilco
   Estilos corporativos
   ===================================================== */

/* ─── Variables CSS ──────────────────────────────────── */
:root {
    --afilco-blue: #2B5797;
    --afilco-blue-dark: #1E3F6F;
    --afilco-blue-light: #E8EEF7;
    --afilco-blue-hover: #3468AD;
    --afilco-red: #C8102E;
    --afilco-red-light: #FDE8EC;
    --afilco-red-hover: #A00D24;

    --sidebar-bg: #1A2035;
    --sidebar-hover: #232940;
    --sidebar-text: #ADB5BD;
    --sidebar-active-text: #FFFFFF;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;

    --topbar-height: 60px;
    --body-bg: #F4F6F9;
    --card-bg: #FFFFFF;
    --text-primary: #212529;
    --text-muted: #6C757D;
    --border-color: #DEE2E6;

    --transition-speed: 0.3s;
}

/* ─── Reset y Base ───────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

a {
    color: var(--afilco-blue);
    text-decoration: none;
}

a:hover {
    color: var(--afilco-blue-dark);
}

/* ─── Sidebar ────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1040;
    transition: transform var(--transition-speed) ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: var(--topbar-height);
}

.sidebar-brand img {
    height: 32px;
    margin-right: 10px;
}

.sidebar-brand h5 {
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.sidebar-brand small {
    color: var(--sidebar-text);
    font-size: 0.7rem;
    font-weight: 400;
}

.sidebar-nav {
    padding: 12px 0;
}

.sidebar-label {
    padding: 12px 20px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(173, 181, 189, 0.5);
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: var(--sidebar-active-text);
    background: var(--sidebar-hover);
}

.sidebar-link.active {
    color: var(--sidebar-active-text);
    background: rgba(43, 87, 151, 0.2);
    border-left-color: var(--afilco-blue);
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 24px;
    margin-right: 12px;
    text-align: center;
}

.sidebar-link .badge {
    margin-left: auto;
    font-size: 0.7rem;
}

/* ─── Topbar ─────────────────────────────────────────── */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1030;
    transition: left var(--transition-speed) ease;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.topbar-toggle {
    display: none;
    border: none;
    background: none;
    font-size: 1.4rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px 8px;
}

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.notification-bell {
    position: relative;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.notification-bell:hover {
    background: var(--body-bg);
    color: var(--text-primary);
}

.notification-bell .count {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--afilco-red);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--afilco-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ─── Contenido principal ────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 24px;
    min-height: calc(100vh - var(--topbar-height));
    transition: margin-left var(--transition-speed) ease;
}

/* ─── Breadcrumbs ────────────────────────────────────── */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--afilco-blue);
}

/* ─── Cards ──────────────────────────────────────────── */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    background: var(--card-bg);
    margin-bottom: 24px;
}

.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 16px 20px;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 20px;
}

/* ─── Metric Cards (Dashboard) ───────────────────────── */
.metric-card {
    border-left: 4px solid var(--afilco-blue);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.metric-card .metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card .metric-icon {
    font-size: 2.5rem;
    opacity: 0.15;
}

.metric-card.border-danger { border-left-color: var(--afilco-red); }
.metric-card.border-warning { border-left-color: #FFC107; }
.metric-card.border-success { border-left-color: #198754; }
.metric-card.border-info { border-left-color: #0DCAF0; }
.metric-card.border-primary { border-left-color: var(--afilco-blue); }

/* ─── Tablas ─────────────────────────────────────────── */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--body-bg);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    font-size: 0.9rem;
}

.table tbody tr {
    transition: background 0.15s ease;
}

.table tbody tr:hover {
    background: var(--afilco-blue-light);
}

.table-clickable tbody tr {
    cursor: pointer;
}

/* ─── Botones ────────────────────────────────────────── */
.btn-primary {
    background-color: var(--afilco-blue);
    border-color: var(--afilco-blue);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--afilco-blue-hover);
    border-color: var(--afilco-blue-hover);
}

.btn-primary:active {
    background-color: var(--afilco-blue-dark) !important;
    border-color: var(--afilco-blue-dark) !important;
}

.btn-danger {
    background-color: var(--afilco-red);
    border-color: var(--afilco-red);
}

.btn-danger:hover, .btn-danger:focus {
    background-color: var(--afilco-red-hover);
    border-color: var(--afilco-red-hover);
}

.btn-outline-primary {
    color: var(--afilco-blue);
    border-color: var(--afilco-blue);
}

.btn-outline-primary:hover {
    background-color: var(--afilco-blue);
    border-color: var(--afilco-blue);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 4px 10px;
}

/* ─── Badges ─────────────────────────────────────────── */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
}

.entity-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
}

/* ─── Formularios ────────────────────────────────────── */
.form-control:focus, .form-select:focus {
    border-color: var(--afilco-blue);
    box-shadow: 0 0 0 0.2rem rgba(43, 87, 151, 0.15);
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 4px;
}

.required::after {
    content: ' *';
    color: var(--afilco-red);
}

/* ─── Alertas ────────────────────────────────────────── */
.alert {
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
}

.alert-danger {
    background: var(--afilco-red-light);
    color: #842029;
}

.alert-primary {
    background: var(--afilco-blue-light);
    color: var(--afilco-blue-dark);
}

/* ─── Status Timeline ────────────────────────────────── */
.status-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 20px 0;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.timeline-step::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
}

.timeline-step:last-child::after {
    display: none;
}

.timeline-step.completed::after {
    background: var(--afilco-blue);
}

.timeline-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    font-size: 0.7rem;
    color: white;
}

.timeline-step.completed .timeline-dot {
    background: var(--afilco-blue);
}

.timeline-step.current .timeline-dot {
    background: var(--afilco-blue);
    box-shadow: 0 0 0 4px rgba(43, 87, 151, 0.2);
}

.timeline-label {
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
}

.timeline-step.completed .timeline-label,
.timeline-step.current .timeline-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* ─── Login Page ─────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--afilco-blue-dark) 0%, var(--afilco-blue) 50%, #3A6DB5 100%);
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 48px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.login-logo {
    margin-bottom: 24px;
}

.login-logo img {
    height: 48px;
}

.login-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 24px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-google:hover {
    border-color: var(--afilco-blue);
    background: var(--afilco-blue-light);
}

.btn-google img {
    height: 20px;
}

.login-footer {
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ─── Empty State ────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .topbar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .topbar-toggle {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: 16px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .metric-card .metric-value {
        font-size: 1.5rem;
    }
}

/* ─── Utilidades ─────────────────────────────────────── */
.text-afilco-blue { color: var(--afilco-blue) !important; }
.text-afilco-red { color: var(--afilco-red) !important; }
.bg-afilco-blue { background-color: var(--afilco-blue) !important; }
.bg-afilco-red { background-color: var(--afilco-red) !important; }
.bg-afilco-blue-light { background-color: var(--afilco-blue-light) !important; }

.cursor-pointer { cursor: pointer; }
.min-w-100 { min-width: 100px; }

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

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

/* ─── Scrollbar personalizada ────────────────────────── */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* ─── DataTables override ────────────────────────────── */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--afilco-blue);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(43, 87, 151, 0.15);
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--afilco-blue) !important;
    color: white !important;
    border-color: var(--afilco-blue) !important;
    border-radius: 6px;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.85rem;
    color: var(--text-muted);
}
