@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-blue: #3b82f6;
    --primary-fuchsia: #d946ef;
    --bg-dark: #020617;
    --card-bg: rgba(17, 25, 40, 0.75);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;

    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    height: 100vh;
    color: var(--text-primary);
    overflow: hidden;
    /* Prevent body scroll, handle in main */
}

/* ================== LOGIN PAGE STYLES (Preserved) ================== */
.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    z-index: 1;
    pointer-events: none;
    animation: float 14s infinite alternate ease-in-out;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-blue), transparent 60%);
    top: -20%;
    left: -10%;
}

.blob-2 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, var(--primary-fuchsia), transparent 60%);
    bottom: -20%;
    right: -10%;
    animation-delay: -5s;
}

.blob-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #6366f1, transparent 60%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 10s infinite alternate ease-in-out;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(30px, 30px);
    }
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.4;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.7;
    }
}

.login-container {
    position: relative;
    z-index: 10;
    background: linear-gradient(145deg, rgba(17, 25, 40, 0.7), rgba(17, 25, 40, 0.4));
    backdrop-filter: blur(20px);
    padding: 3.5rem 2.5rem;
    border-radius: 2px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 420px;
    text-align: center;
    margin: auto;
    /* Center in flex container */
    top: 50vh;
    transform: translateY(-50%);
}

.icon-container {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.15);
}

.icon-container svg {
    color: var(--primary-blue);
    filter: drop-shadow(0 0 5px var(--primary-blue));
}

.login-header h1 {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2.5rem;
    font-weight: 300;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    margin-left: 0.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem 1.25rem;
    background: rgba(2, 6, 23, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 2px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-group input:focus {
    background: rgba(2, 6, 23, 0.8);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-fuchsia));
    border: none;
    border-radius: 2px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    margin-bottom: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 20px -5px rgba(59, 130, 246, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(217, 70, 239, 0.4);
}

.forgot-password {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: color 0.2s;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin-bottom: 1.5rem;
}

.request-access {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.copyright {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hidden {
    display: none;
}

/* ================== DASHBOARD STYLES ================== */

.dashboard-body {
    display: flex;
    height: 100vh;
    background: #0f1219;
    /* Slightly lighter than pure black */
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(13, 17, 26, 0.95);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-icon-small {
    width: 36px;
    height: 36px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    color: var(--primary-blue);
    display: flex;
    justify-content: center;
    align-items: center;
}

.user-profile-mini {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 2px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: var(--primary-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sidebar-footer {
    margin-top: auto;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 1px solid #0f1219;
}

.btn-primary-small {
    background: var(--primary-blue);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.kpi-card {
    background: linear-gradient(145deg, rgba(20, 25, 35, 0.8), rgba(15, 20, 30, 0.6));
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 1.5rem;
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.unit {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.kpi-trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-up {
    color: var(--success-color);
}

.trend-down {
    color: var(--danger-color);
}

.trend-good {
    color: var(--success-color);
}

/* Example: decrease in pending is good */

/* Filters Bar */
.filters-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    width: 350px;
}

.search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 8px;
    color: white;
    outline: none;
    font-size: 0.9rem;
}

.search-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.filter-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

.filter-status {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.dot.high {
    background: var(--danger-color);
}

.dot.med {
    background: var(--warning-color);
}

.dot.low {
    background: var(--success-color);
}

/* Alerts List */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-blue);
}

.alert-item {
    background: rgba(20, 25, 35, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    padding: 1.25rem;
    display: flex;
    gap: 1.25rem;
    margin-bottom: 1rem;
    align-items: center;
    transition: transform 0.2s, background 0.2s;
}

.alert-item:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(4px);
}

.alert-item.critical {
    border-left: 3px solid var(--danger-color);
}

.alert-item.warning {
    border-left: 3px solid var(--warning-color);
}

.alert-item.success {
    border-left: 3px solid var(--success-color);
}

.alert-icon-wrapper {
    background: rgba(255, 255, 255, 0.05);
    width: 44px;
    height: 44px;
    border-radius: 2px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
}

.critical .alert-icon-wrapper {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.warning .alert-icon-wrapper {
    color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

.success .alert-icon-wrapper {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.alert-content {
    flex: 1;
}

.alert-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.alert-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-critical {
    background: var(--danger-color);
    color: #000;
}

.badge-warning {
    background: var(--warning-color);
    color: #000;
}

.badge-success {
    background: var(--success-color);
    color: #000;
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.alert-content p {
    font-size: 0.85rem;
    color: #94a3b8;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--text-secondary);
    color: white;
}

/* ================== TOAST NOTIFICATIONS (Option 3: Gradient Glow) ================== */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    /* Allow clicking through container */
}

.toast-item {
    pointer-events: auto;
    width: 320px;
    background: rgba(30, 41, 59, 0.85);
    /* Slightly more opaque for readability */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    color: white;
    transform: translateX(0);
    opacity: 1;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: toast-slide-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast-item.toast-hide {
    opacity: 0;
    transform: translateX(100%);
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Icons */
.toast-icon {
    font-size: 24px;
    z-index: 2;
}

.toast-success .toast-icon {
    color: var(--success-color);
}

.toast-error .toast-icon {
    color: var(--danger-color);
}

.toast-info .toast-icon {
    color: var(--primary-blue);
}

.toast-warning .toast-icon {
    color: var(--warning-color);
}

/* Content */
.toast-content {
    z-index: 2;
    flex: 1;
}

.toast-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 2px;
    color: white;
}

.toast-message {
    font-size: 0.8rem;
    color: #cbd5e1;
    /* slate-300 */
    line-height: 1.4;
}

/* Glow Effect (Pseudo-element approach for performance) */
.toast-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.15;
    pointer-events: none;
}

.toast-success .toast-glow {
    background: linear-gradient(90deg, var(--success-color), transparent);
}

.toast-error .toast-glow {
    background: linear-gradient(90deg, var(--danger-color), transparent);
}

.toast-info .toast-glow {
    background: linear-gradient(90deg, var(--primary-blue), transparent);
}

.toast-warning .toast-glow {
    background: linear-gradient(90deg, var(--warning-color), transparent);
}

/* Styles ported from modelo_cod.html */
.glass-panel {
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    border-radius: 2px !important; /* Forzar rounded-sm (2px) profesional */
}

.glass-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.glass-card, .glass-modal {
    border-radius: 6px !important; /* Forzar rounded-sm (6px) profesional */
    isolation: isolate;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.glass-sub-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
}

.glass-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    transition: all 0.3s ease;
}

.glass-input:focus,
.glass-input:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(56, 189, 248, 0.4);
    outline: none;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.1);
}

.glass-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
    transform: translateY(-1px);
}

.status-glow-green {
    box-shadow: 0 0 20px rgba(45, 212, 191, 0.3);
    border: 1px solid rgba(45, 212, 191, 0.3);
}

.text-glow {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* ================== SWEETALERT 2 CUSTOM NEON GLOW ================== */
.swal2-timer-progress-bar {
    background: linear-gradient(90deg, var(--primary-blue), var(--primary-fuchsia)) !important;
    height: 4px !important;
    box-shadow: 0 -2px 10px rgba(217, 70, 239, 0.5), 0 -2px 5px rgba(59, 130, 246, 0.8) !important;
    opacity: 1 !important;
}

div.swal2-toast {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}