:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --gold: #eab308;
    --gold-hover: #ca8a04;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --danger: #e11d48;
    --danger-bg: #fff1f2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

/* Header */
.cd-header {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Playfair Display', serif;
    letter-spacing: 1px;
}

.logo span {
    color: var(--gold);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-wrapper {
    position: relative;
}

.search-wrapper input {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 15px 8px 35px;
    border-radius: 20px;
    color: white;
    outline: none;
    transition: 0.3s;
}

.search-wrapper input:focus {
    border-color: var(--gold);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
}

.nav-btn:hover {
    background: var(--bg-card);
    color: white;
    border-color: var(--gold);
}

.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* Landing Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
    min-height: 80vh;
}

.hero-section h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 20px;
    font-family: 'Playfair Display', serif;
}

.highlight {
    color: var(--gold);
}

.hero-section p {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.badge-gold {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: var(--gold);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 20px;
}

/* Forms */
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.auth-card h3 {
    font-size: 1.5rem;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.scrollable-form {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.req {
    color: var(--danger);
}

.cd-input {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: white;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: 0.3s;
}

.cd-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.1);
}

.cd-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cd-input.error {
    border-color: var(--danger);
    background: rgba(225, 29, 72, 0.05);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1.5fr;
    gap: 15px;
}

.cta-gold {
    width: 100%;
    background: linear-gradient(135deg, var(--gold) 0%, #a16207 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 10px 20px rgba(234, 179, 8, 0.2);
}

.cta-gold:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(234, 179, 8, 0.4);
}

.cta-gold:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.text-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    margin-top: 15px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.3s;
}

.text-btn:hover {
    color: white;
    text-decoration: underline;
}

/* File Uploads */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.btn-upload {
    background: var(--bg-dark);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: 0.3s;
    font-family: 'Outfit', sans-serif;
}

.btn-upload:hover {
    border-color: var(--gold);
    color: white;
}

.file-status {
    font-size: 0.75rem;
    background: var(--border-color);
    padding: 3px 8px;
    border-radius: 6px;
}

.btn-upload.success {
    border-color: #10b981;
    border-style: solid;
    color: white;
}

.btn-upload.success .file-status {
    background: #10b981;
    color: white;
}

/* Dashboard & Alerts */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.city-tag {
    background: rgba(234, 179, 8, 0.1);
    color: var(--gold);
    border: 1px solid rgba(234, 179, 8, 0.3);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    vertical-align: middle;
}

.live-pulse {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    color: #10b981;
    letter-spacing: 1px;
    background: rgba(16, 185, 129, 0.1);
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    text-transform: uppercase;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
    animation: pulseEmerald 1.5s infinite;
}

@keyframes pulseEmerald {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.alert-card {
    background: var(--bg-card);
    border-left: 4px solid var(--danger);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: 0.3s;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
}

.alert-card:hover {
    transform: translateX(5px);
    border-color: var(--border-color);
    border-left-color: var(--danger);
}

.alert-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
}

.alert-tag {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: bold;
    border: 1px solid #fecdd3;
}

.alert-patient {
    font-size: 1.4rem;
    color: white;
    font-weight: 700;
    margin-bottom: 5px;
}

.alert-company {
    font-size: 0.9rem;
    color: var(--gold);
}

.alert-details {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 10px;
}

.btn-attend {
    background: transparent;
    border: 1px solid var(--border-color);
    color: white;
    padding: 12px 25px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-attend:hover {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

/* Pagination */
.pagination-area {
    text-align: center;
    margin-top: 30px;
    border-top: 1px dashed var(--border-color);
    padding-top: 20px;
}

.btn-load-more {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--gold);
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
}

.btn-load-more:hover {
    background: var(--gold);
    color: var(--bg-dark);
}

/* Modals & Loaders */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-card {
    position: relative;
    z-index: 1;
    background: var(--bg-card);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.success-card h3 {
    color: var(--gold);
    margin-bottom: 15px;
}

.success-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.loader-container {
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsiveness */
@media (max-width: 900px) {
    .split-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .hero-section {
        text-align: center;
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    .hero-section p {
        margin: 0 auto;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .alert-card {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .btn-attend {
        width: 100%;
    }

    .search-wrapper {
        display: none;
    }

    /* Ocultar buscador en móvil por espacio */
}


/* ==========================================
   SPLIT SCREEN & GESTIÓN DE CASOS (PREMIUM)
========================================== */
.split-dashboard-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    position: relative;
    width: 100%;
}

.alerts-list-panel {
    flex: 1;
    min-width: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.case-management-panel {
    width: 55%;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: sticky;
    top: 90px;
    height: calc(100vh - 120px);
}

.empty-state-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.empty-state-panel h3 {
    color: var(--text-main);
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.case-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.case-body {
    padding: 30px;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.case-footer {
    padding: 20px 30px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

/* Tarjetas de Información */
.info-box-premium {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.info-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item span {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 3px;
}

.info-item strong {
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-word;
}

/* Pasos de Intervención */
.step-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    border-left: 4px solid var(--border-color);
}

.step-container.active {
    background: rgba(234, 179, 8, 0.05);
    border-color: rgba(234, 179, 8, 0.2);
    border-left-color: var(--gold);
}

.step-container.completed {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
    border-left-color: #10b981;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.step-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.step-checkbox input {
    width: 20px;
    height: 20px;
    accent-color: var(--gold);
    cursor: pointer;
}

.step-checkbox span {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1rem;
}

.step-dropdown {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
    animation: slideDown 0.3s ease-out forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cd-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 15px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 120px;
    outline: none;
    transition: border-color 0.3s;
}

.cd-textarea:focus {
    border-color: var(--gold);
}

.btn-icon-soft {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: 0.2s;
}

.btn-icon-soft:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Responsive Absoluto */
@media (max-width: 1024px) {
    .split-dashboard-layout {
        flex-direction: column;
    }

    .case-management-panel {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9999;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        border: none;
        display: none;
        /* Se oculta completamente en móvil hasta que se active */
    }

    .case-management-panel.mobile-active {
        display: flex;
    }
}

/* ==========================================
   MÓDULO DE PERFIL INSTITUCIONAL (PREMIUM)
========================================== */
.profile-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    align-items: start;
}

.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Avatar Wrapper */
.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 25px;
    margin-bottom: 25px;
}

.avatar-wrapper {
    position: relative;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    padding: 5px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background: var(--bg-dark);
}

.avatar-edit-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 38px;
    height: 38px;
    background: var(--text-main);
    color: var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 3px solid var(--bg-card);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.avatar-edit-btn:hover {
    transform: scale(1.15) rotate(5deg);
    background: var(--gold);
}

.avatar-loader {
    position: absolute;
    inset: 5px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Info Grid */
.profile-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-block {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-block span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.info-block strong {
    font-size: 0.95rem;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    word-break: break-word;
}

/* Contact Admin Area */
.admin-contact-area {
    margin-top: 30px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    padding: 25px;
    transition: all 0.3s ease;
}

.admin-contact-area.success {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.contact-textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 15px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 120px;
    outline: none;
    transition: border-color 0.3s;
    margin-top: 15px;
}

.contact-textarea:focus {
    border-color: #6366f1;
}

@media (max-width: 900px) {
    .profile-layout {
        grid-template-columns: 1fr;
    }

    .profile-info-grid {
        grid-template-columns: 1fr;
    }
}