@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-app: #F9FAFB;
    --sidebar-primary: #020617;
    /* WoDev Navy */
    --sidebar-secondary: #FFFFFF;
    --border-color: #F0F0F2;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --wodev-cyan: #06b6d4;
    --wodev-blue: #2563eb;
    --wodev-gradient: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);
    --accent: #2563eb;
}

/* --- TEMAS DINÁMICOS POR HORA --- */
body.theme-morning {
    --bg-app: #FAFAFA;
    --wodev-gradient: linear-gradient(135deg, #FF9A8B 0%, #FF6A88 55%, #FF99AC 100%);
}

body.theme-afternoon {
    --wodev-gradient: linear-gradient(135deg, #FAD961 0%, #F76B1C 100%);
}

body.theme-night {
    --bg-app: #020617;
    --wodev-gradient: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    --text-main: #f1f5f9;
}

/* Efectos de Brillo Atmosférico */
.main-content::before {
    content: '';
    position: fixed;
    width: 60%;
    height: 60%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
    transition: all 2s ease;
}

body.theme-morning .main-content::before {
    top: -10%;
    left: -10%;
    background: radial-gradient(circle, rgba(255, 154, 139, 0.2) 0%, transparent 70%);
}

body.theme-afternoon .main-content::before {
    top: 10%;
    right: -5%;
    background: radial-gradient(circle, rgba(247, 107, 28, 0.15) 0%, transparent 70%);
}

body.theme-night .main-content::before {
    bottom: -10%;
    left: 20%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
}

body.theme-night .modern-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

body.theme-night h1,
body.theme-night h2,
body.theme-night h3,
body.theme-night h4 {
    color: white !important;
}

body.theme-night .sidebar-secondary {
    background: #020617;
    border-right-color: rgba(255, 255, 255, 0.05);
}

body.theme-night .secondary-nav-link {
    color: #94a3b8;
}

body.theme-night .secondary-nav-link:hover,
body.theme-night .secondary-nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* ESTRUCTURA DUAL SIDEBAR */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Barra Primaria (Extrema Izquierda) - DARK MODE */
.sidebar-primary {
    width: 72px;
    background: var(--sidebar-primary);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    flex-shrink: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.logo-box {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    overflow: hidden;
}

.logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.primary-nav-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #64748B;
    transition: all 0.2s ease;
    margin-bottom: 16px;
    text-decoration: none;
}

.primary-nav-link i {
    width: 20px;
    height: 20px;
    stroke-width: 1.5px;
}

.primary-nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.primary-nav-link.active {
    background: var(--wodev-gradient);
    color: white;
    box-shadow: 0 8px 16px rgba(6, 182, 212, 0.2);
}

/* Barra Secundaria (Navegación) */
.sidebar-secondary {
    width: 280px;
    background: var(--sidebar-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 32px 24px;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-secondary.collapsed {
    width: 0;
    padding: 32px 0;
    opacity: 0;
    pointer-events: none;
    border-right: 0;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
    background: var(--bg-app);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.secondary-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.secondary-nav-link:hover {
    background: #F8FAFC;
    color: #1E293B;
}

.secondary-nav-link.active {
    background: #EEF2FF;
    color: var(--wodev-blue);
    font-weight: 700;
}

.secondary-nav-link i {
    width: 16px;
    height: 16px;
    margin-right: 12px;
    stroke-width: 1.5px;
}

.section-label {
    font-size: 10px;
    font-weight: 800;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 32px 16px 12px 16px;
    display: block;
}

/* SEARCH BOX */
.search-container {
    position: relative;
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    background: #F9FAFB;
    border: 1px solid #F3F4F6;
    border-radius: 12px;
    padding: 10px 12px 10px 40px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: #E5E7EB;
    background: #FFFFFF;
}



/* MODALS */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    /* Menos padding exterior */
}

.modal-content {
    background: white;
    border-radius: 24px;
    /* Un poco menos redondeado para ganar espacio */
    padding: 24px;
    /* Mucho menos padding interno */
    width: 100%;
    max-width: 550px;
    max-height: 95vh;
    /* Ocupar casi toda la pantalla si es necesario */
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    position: relative;
    scrollbar-width: thin;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 10px;
}

.hidden {
    display: none !important;
}

/* UTILS */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

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

.modern-card {
    background: white;
    border-radius: 24px;
    padding: 32px;
    border: 1px solid #F0F0F2;
    transition: all 0.3s ease;
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.04);
}

/* Planificador Visual Extra Styles */
.scheduler-grid-line {
    border-right: 1px dashed #e2e8f0;
}

.scheduler-container {
    border-radius: 3rem;
    overflow: hidden;
}

/* COMMAND CENTER SIDEBAR */
.command-center {
    width: 320px;
    background: white;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
}

.command-center.collapsed {
    width: 0;
    opacity: 0;
    pointer-events: none;
}



.command-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* CHAT BUBBLES */
.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 12px;
    line-height: 1.5;
    position: relative;
}

.chat-bubble.mine {
    background: #0F172A;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-bubble.others {
    background: #F8FAFC;
    color: #1A1C1E;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #F1F5F9;
}

.chat-time {
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    margin-top: 4px;
    opacity: 0.5;
}

#chat-messages {
    display: flex;
    flex-direction: column;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

/* --- ROLES: READ ONLY MODE (SPONSOR) --- */
body.role-readonly button[onclick*="delete"],
body.role-readonly button[onclick*="open"],
body.role-readonly button[onclick*="edit"],
body.role-readonly button[onclick*="create"],
body.role-readonly button[onclick*="handleSave"],
body.role-readonly button[id*="btn-delete"],
body.role-readonly button[id*="btn-create"],
body.role-readonly .btn-action-edit,
body.role-readonly .btn-action-delete,
body.role-readonly .modern-card button {
    display: none !important;
}

/* En modo solo lectura, los modales se vuelven paneles de visualización */
body.role-readonly .modal-content button:not([onclick*="classList.add('hidden')"]) {
    display: none !important;
}

body.role-readonly .modal-content input,
body.role-readonly .modal-content select,
body.role-readonly .modal-content textarea {
    pointer-events: none;
    opacity: 0.8;
}