/* SOSQR - Global Premium Style System */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #005a9c;
    --primary-dark: #003f6d;
    --secondary: #6c757d;
    --danger: #ff3e3e;
    --danger-dark: #cc0000;
    --success: #28a745;
    --warning: #ffc107;
    --info: #17a2b8;

    /* Neutral Colors */
    --bg-main: #f4f7f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border-color: rgba(223, 230, 233, 0.5);

    /* Effects */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --radius-md: 12px;
    --radius-lg: 20px;

    /* Animation */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
    background: radial-gradient(circle at 10% 20%, rgba(0, 90, 156, 0.05) 0%, rgba(244, 247, 249, 1) 90.2%);
}

/* Premium Components */

/* Cards */
.premium-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    overflow: hidden;
}

.premium-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Buttons */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    gap: 8px;
    font-size: 1rem;
}

.btn-premium-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 90, 156, 0.3);
}

.btn-premium-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 90, 156, 0.4);
    transform: scale(1.02);
}

.btn-premium-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(255, 62, 62, 0.3);
}

.btn-premium-danger:hover {
    box-shadow: 0 6px 20px rgba(255, 62, 62, 0.4);
    transform: scale(1.02);
}

/* Form Inputs */
.premium-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    transition: var(--transition);
    font-size: 1rem;
}

.premium-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 90, 156, 0.1);
}

/* Headers */
.branding-bar {
    background: white;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1001;
}

.branding-left {
    display: flex;
    align-items: center;
    gap: 3rem;
}

.branding-bar img {
    max-height: 45px;
    display: block;
}

/* Brand Navigation Menu */
.brand-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.brand-nav-item {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.brand-nav-item:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Dropdown Logic */
.brand-dropdown {
    position: relative;
}

.brand-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    padding: 0.5rem 0;
    z-index: 1002;
    border: 1px solid var(--glass-border);
    margin-top: 0.5rem;
    animation: slideDown 0.2s ease-out;
}

/* Robust bridge to prevent menu from closing when moving mouse from toggle to content */
/* Uses a pseudo-element that extends UPWARDS to cover the margin-top gap */
.brand-dropdown-content::before {
    content: '';
    position: absolute;
    top: -20px;
    /* Cubre el hueco del margin-top de sobra */
    left: 0;
    right: 0;
    height: 25px;
    /* Altura suficiente para el puente */
    background: transparent;
    z-index: -1;
}

.brand-dropdown:hover .brand-dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.7rem 1.2rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.dropdown-link:hover {
    background: var(--bg-main);
    color: var(--primary);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.premium-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1rem 2rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Glass Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: var(--radius-md);
}

/* Stats Widgets */
.stat-widget {
    text-align: center;
    padding: 1.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Action Buttons - Pill Style */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    gap: 6px;
    text-wrap: nowrap;
}

.btn-action-edit {
    background: rgba(0, 90, 156, 0.1);
    color: var(--primary);
    border-color: rgba(0, 90, 156, 0.2);
}

.btn-action-edit:hover {
    background: var(--primary);
    color: white;
}

.btn-action-token {
    background: rgba(180, 83, 9, 0.1);
    color: #b45309;
    border-color: rgba(180, 83, 9, 0.2);
}

.btn-action-token:hover {
    background: #b45309;
    color: white;
}

.btn-action-manage {
    background: rgba(108, 117, 125, 0.1);
    color: var(--secondary);
    border-color: rgba(108, 117, 125, 0.2);
}

.btn-action-manage:hover {
    background: var(--secondary);
    color: white;
}

.btn-action-delete {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.2);
}

.btn-action-delete:hover {
    background: #dc3545;
    color: white;
}

.btn-action-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
    border-color: rgba(40, 167, 69, 0.2);
}

.btn-action-success:hover {
    background: var(--success);
    color: white;
}

.btn-action-primary {
    background: rgba(0, 90, 156, 0.1);
    color: var(--primary);
    border-color: rgba(0, 90, 156, 0.2);
}

.btn-action-primary:hover {
    background: var(--primary);
    color: white;
}

/* Layout Utilities */
.section-separator {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--border-color);
}

.premium-title {
    position: relative;
    padding-left: 15px;
    margin-bottom: 2rem;
}

.premium-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
}

/* Custom Table Overrides */
.premium-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.premium-table th {
    background: rgba(0, 90, 156, 0.03);
    color: var(--primary);
    padding: 1rem;
    font-weight: 700;
    text-align: left;
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border-color);
}

.premium-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.action-cell {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Phone Prefix Styles */
.phone-prefix-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    overflow: hidden;
    transition: var(--transition);
}

.phone-prefix-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 90, 156, 0.1);
}

.prefix-label {
    background: var(--primary);
    padding: 12px 14px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    user-select: none;
}

.phone-prefix-group .premium-input {
    border: none;
    border-radius: 0;
    padding-left: 10px;
}

/* Grade Selection Refinements */
.grade-group {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: var(--transition);
}

.grade-group:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.grade-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.grade-group-header strong {
    color: var(--primary);
    font-size: 0.95rem;
}

.grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.grade-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-main);
    padding: 4px 0;
}

.grade-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.phone-prefix-group .premium-input:focus {
    box-shadow: none;
}

/* Navigation Tabs - Glassmorphism System */
.tab-group {
    display: flex;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.6rem;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    width: fit-content;
    margin-bottom: 2.5rem;
    transition: var(--transition);
    position: sticky;
    top: 1rem;
    z-index: 900;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 14px;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-button i {
    font-size: 1.1rem;
    opacity: 0.75;
    transition: var(--transition);
}

.tab-button:hover {
    background: rgba(0, 90, 156, 0.05);
    color: var(--primary);
    transform: translateY(-1px);
}

.tab-button.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(0, 90, 156, 0.25);
}

.tab-button.active i {
    opacity: 1;
    transform: scale(1.1);
    color: white !important;
}

/* Modern Status Pills */
.status-badge {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-alerted,
.status-ALERTA {
    background: linear-gradient(135deg, #ff4b2b, #ff416c);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 75, 43, 0.2);
}

.status-resolved,
.status-RESUELTO,
.status-Resuelto {
    background: linear-gradient(135deg, #56ab2f, #a8e063);
    color: white;
    box-shadow: 0 4px 12px rgba(86, 171, 47, 0.2);
}

.status-Nuevo {
    background: linear-gradient(135deg, #2193b0, #6dd5ed);
    color: white;
}

.status-En-Revisión {
    background: linear-gradient(135deg, #f12711, #f5af19);
    color: white;
}

/* Enhanced Premium Table */
.premium-table-container {
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    margin-top: 1.5rem;
}

.premium-table thead th {
    background: rgba(0, 90, 156, 0.05);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--primary-dark);
    border-bottom: 2px solid rgba(0, 90, 156, 0.1);
}

.premium-table tbody tr {
    transition: var(--transition);
}

.premium-table tbody tr:hover {
    background: rgba(0, 90, 156, 0.02);
    transform: scale(1.002);
}

/* Modern Form Sections */
.form-section-card {
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    padding: 2rem;
    border: 1px solid var(--glass-border);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.form-section-title {
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section-title i {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Icon-lead inputs */
.premium-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.premium-input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-main);
}

/* Dashboard Titles Improvement */
.premium-title h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    background: linear-gradient(45deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Modales Premium (Popup Style) --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    /* Backdrop más ligero */
    backdrop-filter: blur(4px);
    /* Blur más suave */
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    overflow: auto;
    padding: 1rem;
}

.modal-content {
    animation: popupIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 450px;
    width: 100%;
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Tipos de Notificación */
.notif-success #notificationIcon {
    color: var(--success) !important;
}

.notif-error #notificationIcon {
    color: var(--danger) !important;
}

.notif-warning #notificationIcon {
    color: var(--warning) !important;
}

.notif-info #notificationIcon {
    color: var(--info) !important;
}