﻿/* =========================================================
   app.css - Estilos base y componentes globales (versión completa)
   ========================================================= */

/* ---------- Variables (tema claro) ---------- */
:root {
    --azure-blue: #0078D4;
    --azure-blue-dark: #005A9E;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-700: #495057;
    --gray-900: #212529;
    --bg-primary: #ffffff;
    --bg-secondary: #f0f2f5;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-light: #dee2e6;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --radius-lg: 0.5rem;
    --radius-full: 9999px;
}

/* ---------- Reset y base ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Roboto', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

a {
    color: var(--azure-blue);
    text-decoration: none;
    transition: color 0.2s;
}

    a:hover {
        color: var(--azure-blue-dark);
        text-decoration: underline;
    }

/* ---------- Layout principal ---------- */
.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--azure-blue);
}

.main-content {
    flex: 1;
    padding-top: 0 !important;
}

.main-footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    padding: 1rem 0;
}

.footer-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-copyright {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-social a {
    margin-left: 0.75rem;
    color: var(--text-secondary);
}

/* ---------- Navegación principal (navbar) ---------- */
.navbar-dark.bg-custom {
    background-color: #0a1c3a !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9);
    transition: background-color 0.2s, color 0.2s;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none !important;
}

    .navbar-dark .navbar-nav .nav-link:hover,
    .navbar-dark .navbar-nav .nav-link:focus {
        color: #ffffff;
        background-color: rgba(255, 255, 255, 0.15);
        text-decoration: none;
    }

.dropdown-menu {
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 0.5rem;
}

.dropdown-item {
    color: #1e293b !important;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    transition: background-color 0.2s;
    text-decoration: none !important;
}

    .dropdown-item:hover, .dropdown-item:focus {
        background-color: #eef2ff !important;
        color: #0f172a !important;
        text-decoration: none;
    }

.dropdown-header {
    color: #6c757d;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-divider {
    margin: 0.25rem 0;
}

@media (max-width: 991px) {
    .navbar-dark .dropdown-menu {
        background-color: #1e293b;
        border: none;
    }

    .navbar-dark .dropdown-item {
        color: rgba(255,255,255,0.9) !important;
    }

        .navbar-dark .dropdown-item:hover {
            background-color: rgba(255,255,255,0.15) !important;
            color: white !important;
            text-decoration: none;
        }
}

/* ---------- Perfil de usuario ---------- */
.user-profile {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    cursor: pointer;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--azure-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 1050;
}

    .user-dropdown.active {
        display: block;
    }

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
}

    .user-dropdown-item:hover {
        background-color: var(--gray-100);
        text-decoration: none;
    }

.user-dropdown-divider {
    height: 1px;
    background-color: var(--border-light);
    margin: 0.25rem 0;
}

/* ---------- Notificaciones (campanita y drawer) ---------- */
.notification-bell {
    position: relative;
}

#notificationBell {
    background: transparent;
    border: none;
    color: #fff;
    transition: transform 0.2s;
}

    #notificationBell:hover {
        transform: scale(1.05);
    }

#notificationBadge {
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }

    70% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
}

.notification-drawer {
    position: fixed;
    top: 0;
    right: -380px;
    width: 360px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: right 0.3s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e9ecef;
}

    .notification-drawer.visible {
        right: 0;
    }

.drawer-header {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    font-weight: 600;
}

.drawer-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}

    .notification-item:hover {
        background: #f8f9fa;
    }

    .notification-item i {
        font-size: 1.2rem;
    }

/* ---------- Botones y utilidades ---------- */
.btn-primary {
    background-color: var(--azure-blue);
    border-color: var(--azure-blue);
}

    .btn-primary:hover {
        background-color: var(--azure-blue-dark);
        border-color: var(--azure-blue-dark);
        transform: translateY(-1px);
    }

.btn-outline-primary {
    border-color: var(--azure-blue);
    color: var(--azure-blue);
}

    .btn-outline-primary:hover {
        background-color: var(--azure-blue);
        color: white;
    }

.btn, .btn-sm {
    transition: all 0.2s ease;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-icon-only {
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
}

    .btn-icon-only i {
        transition: transform 0.1s;
    }

    .btn-icon-only:hover i {
        transform: scale(1.1);
    }

.rounded-3 {
    border-radius: 0.5rem !important;
}

.rounded-4 {
    border-radius: 1rem !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

/* ---------- Tarjetas y estadísticas ---------- */
.card {
    border: none;
    border-radius: 1rem;
    background: white;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

    .card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-md);
    }

.stat-card {
    background: white;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 24px rgba(0,0,0,0.1) !important;
    }

.stat-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Badges y opacidad ---------- */
.badge.bg-opacity-10 {
    backdrop-filter: blur(4px);
}

.bg-danger.bg-opacity-10 {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.bg-primary.bg-opacity-10 {
    background-color: rgba(0, 120, 212, 0.1) !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.bg-info.bg-opacity-10 {
    background-color: rgba(13, 202, 240, 0.1) !important;
}

.bg-secondary.bg-opacity-10 {
    background-color: rgba(108, 117, 125, 0.1) !important;
}

/* ---------- Encabezados compactos (fondo oscuro azul) ---------- */
.bg-gradient-primary {
    background: linear-gradient(135deg, #0b2b5c 0%, #1e4a7a 100%);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

    .bg-gradient-primary h2,
    .bg-gradient-primary .h2,
    .bg-gradient-primary p,
    .bg-gradient-primary .small,
    .bg-gradient-primary .opacity-75 {
        color: white !important;
    }

    .bg-gradient-primary .text-muted {
        color: rgba(255,255,255,0.85) !important;
    }

    /* Versión para cuando se usa .text-white (por compatibilidad) */
    .bg-gradient-primary.text-white {
        background: linear-gradient(135deg, #0b2b5c 0%, #1e4a7a 100%) !important;
        color: white !important;
    }

.page-header {
    margin-bottom: 1rem;
}

    .page-header h2,
    .page-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

    .page-header p {
        font-size: 0.85rem;
        margin-bottom: 0;
        opacity: 0.9;
    }

/* ---------- Modales con blur ---------- */
.modal-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border: none;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    background: transparent;
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(0,0,0,0.1);
    background: transparent;
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

/* ---------- Toasts ---------- */
.toast-container {
    z-index: 1080;
}

.toast {
    border-radius: 0.5rem;
}

.toast-achv {
    border-left: 5px solid #22c55e;
    background: #111827;
    color: #e5e7eb;
    border-radius: 0.75rem;
    min-width: 280px;
}

.toast-achv--success {
    border-left-color: #22c55e;
}

.toast-achv--warning {
    border-left-color: #f59e0b;
}

.toast-achv--danger {
    border-left-color: #ef4444;
}

.toast-achv--info {
    border-left-color: #3b82f6;
}

.toast-achv__icon {
    width: 44px;
    height: 44px;
    background: rgba(34,197,94,0.15);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-achv__title {
    font-weight: 700;
}

.toast-achv__message {
    font-size: 0.875rem;
    color: #cbd5e1;
}

/* ---------- Animaciones de entrada ---------- */
.transition-hover {
    transition: all 0.2s ease-in-out;
}

    .transition-hover:hover {
        transform: translateY(-3px);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
    }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .header-container {
        padding: 0 0.75rem;
    }

    .main-content {
        padding: 1rem 0;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .notification-drawer {
        width: 100%;
        right: -100%;
    }

    .page-header h2 {
        font-size: 1.25rem;
    }

    .stat-card .display-5 {
        font-size: 1.5rem;
    }
}
