/* ========================================
   GENESIS SEGUROS - SISTEMA DE COLORES MEJORADO
   Garantiza visualización correcta en todos los roles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== COLORES BASE (Fallback) ===== */
:root {
    /* Azul por defecto */
    --primary: #28365F;
    --primary-dark: #1a2340;
    --primary-light: #5B7BB4;
    --accent: #5B7BB4;
    --hover: rgba(40, 54, 95, 0.2);
    
    /* Header por defecto (azul) */
    --header-start: #5B7BB4;
    --header-middle: #3d5a8c;
    --header-end: #28365F;
    
    /* Colores estáticos */
    --gris-oscuro: #2c2c2c;
    --gris-medio: #4a4a4a;
    --gris-claro: #f4f4f4;
    --blanco: #ffffff;
    --negro: #000000;
    
    /* Estados */
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
}

/* ===== ESTILOS GENERALES ===== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gris-claro);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== HEADER MEJORADO ===== */
.main-header {
    background: linear-gradient(135deg, 
        var(--header-start, #5B7BB4) 0%, 
        var(--header-middle, #3d5a8c) 50%, 
        var(--header-end, #28365F) 100%) !important;
    color: white !important;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: 70px;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    position: relative;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1001;
}

.logo img {
    height: 50px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
    filter: brightness(1.1) drop-shadow(1px 1px 2px rgba(0,0,0,0.2));
}

.logo h2 {
    font-size: 1.3rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin: 0;
    white-space: nowrap;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    color: white !important;
}

/* Navegación */
.main-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 1rem;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.main-nav li {
    margin: 0;
}

.main-nav a {
    color: white !important;
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 5px;
    transition: all 0.3s;
    display: block;
    font-size: 0.95rem;
    white-space: nowrap;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.main-nav a:hover, 
.main-nav a.active {
    background: rgba(255,255,255,0.25) !important;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    z-index: 1001;
}

.user-badge {
    background: rgba(255,255,255,0.3);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    color: white !important;
    border: 2px solid rgba(255,255,255,0.5);
}

.user-name {
    font-weight: 500;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Botón hamburguesa */
.menu-toggle {
    display: none;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white !important;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    border-radius: 5px;
    z-index: 1001;
    transition: all 0.3s;
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== BOTONES (AZUL POR DEFECTO) ===== */
.btn {
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
    color: white !important;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary)) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: var(--gris-medio);
    color: white;
}

.btn-secondary:hover {
    background: var(--gris-oscuro);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: var(--warning);
    color: var(--gris-oscuro);
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
}

.page-header h1 {
    color: var(--primary);
    font-size: 2rem;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gris-oscuro);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 0.7rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--hover) !important;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ===== MODAL ===== */
.form-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    overflow: auto;
}

.form-modal-content {
    background: white;
    margin: 2rem auto;
    padding: 2rem;
    max-width: 900px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gris-medio);
}

.close:hover {
    color: var(--primary);
}

/* ===== TABLES ===== */
.data-table {
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.data-table thead {
    background: var(--primary) !important;
    color: white !important;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: white !important;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.data-table tbody tr:hover {
    background: var(--hover);
}

/* ===== BADGES ===== */
.badge {
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: var(--hover);
    color: var(--primary);
}

.badge-primary {
    background: var(--primary);
    color: white;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: var(--hover);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.stat-icon {
    font-size: 3rem;
}

.stat-info h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-info p {
    opacity: 0.9;
}

/* ===== ACTIVITIES GRID ===== */
.actividades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.actividad-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
    border-left: 4px solid var(--primary);
}

.actividad-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.actividad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.actividad-precio {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: bold;
    margin: 1rem 0;
}

.actividad-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* ===== SECTION ===== */
.section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.section h2 {
    color: var(--primary);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

/* ===== NOTIFICACIONES ===== */
.notif-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white !important;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    border-radius: 50%;
    position: relative;
    transition: all 0.3s;
}

.notif-icon:hover {
    background: rgba(255,255,255,0.3);
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.notif-dropdown,
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: white;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
}

.notif-dropdown.show,
.dropdown-content.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notif-header {
    background: var(--primary);
    color: white;
    padding: 1rem;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.mark-all-read {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
}

.mark-all-read:hover {
    background: rgba(255,255,255,0.3);
}

.notif-item {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.3s;
}

.notif-item:hover {
    background: var(--gris-claro);
}

.notif-item strong {
    display: block;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.notif-item p {
    color: var(--gris-oscuro);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.notif-item small {
    color: var(--gris-medio);
    font-size: 0.8rem;
}

.notif-empty {
    padding: 2rem;
    text-align: center;
    color: var(--gris-medio);
}

/* ===== DROPDOWN USER ===== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background: rgba(255,255,255,0.2);
    color: white !important;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 5px;
    transition: all 0.3s;
}

.dropbtn:hover,
.dropbtn.active {
    background: rgba(255,255,255,0.3);
    transform: rotate(180deg);
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background 0.3s;
}

.dropdown-content a:hover {
    background: var(--gris-claro);
}

/* ===== SEARCH BAR ===== */
.search-bar {
    margin-bottom: 2rem;
}

.search-bar form {
    display: flex;
    gap: 1rem;
}

.search-bar input {
    flex: 1;
    padding: 0.7rem;
    border: 2px solid #ddd;
    border-radius: 5px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-container {
        padding: 0.5rem 1rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .main-nav {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: linear-gradient(135deg, var(--header-start), var(--header-end));
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: 0 4px 10px rgba(0,0,0,0.3);
        margin: 0;
    }
    
    .main-nav.show {
        max-height: 500px;
    }
    
    .main-nav ul {
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .main-nav a {
        padding: 1rem;
        text-align: center;
    }
    
    .logo h2 {
        font-size: 1.1rem;
    }
    
    .logo img {
        height: 40px;
    }
    
    .user-name {
        display: none;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .actividades-grid {
        grid-template-columns: 1fr;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .notif-dropdown,
    .dropdown-content {
        right: -80px;
        min-width: 280px;
    }
}

/* ===== UTILITIES ===== */
.text-primary {
    color: var(--primary) !important;
}

.bg-primary {
    background: var(--primary) !important;
    color: white !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

.no-logo {
    width: 40px;
    height: 40px;
    background: var(--gris-claro);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 1.5rem;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ===== IMPRESIÓN ===== */
@media print {
    .main-header,
    .notif-icon,
    .user-menu,
    .btn {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
}