/**
 * PUNTO 0 — ASSETS/CSS/VIEWS/VIEWS-INTERACTIVE.CSS
 * Estilos de Agenda, Tablero/Muro, El Living y Galería con escala Z-Index unificada.
 */

/* =========================================================================
   1. AGENDA V2 (#proyd-agenda-overlay)
   ========================================================================= */
#proyd-agenda-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background-color: var(--bg-deep) !important;
    z-index: var(--z-overlay-view) !important;
    display: flex !important;
    flex-direction: column !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    overflow: hidden !important;
    font-family: var(--font-mono) !important;
    color: var(--text-main) !important;
    box-sizing: border-box !important;
}
#proyd-agenda-overlay.open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}
#proyd-agenda-overlay * {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

#proyd-agenda-grain {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2;
    pointer-events: none !important;
    overflow: hidden !important;
}
#proyd-agenda-grain::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='agNoise'><feTurbulence type='turbulence' baseFrequency='3' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23agNoise)'/></svg>");
    animation: v2CenterNoiseDance 0.2s infinite steps(4);
    opacity: 0.12;
    filter: contrast(165%) brightness(100%);
    pointer-events: none;
}

.agenda-top-header {
    position: relative;
    z-index: 10;
    height: 56px;
    min-height: 56px;
    flex: 0 0 56px;
    width: 100%;
    padding: 0 24px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}
.agenda-top-left {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-self: start;
}
.tablero-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
}
.btn-ag-new-event {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    color: var(--text-main) !important;
    padding: 6px 12px !important;
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.8px !important;
    text-transform: uppercase !important;
    border-radius: 2px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    outline: none !important;
}
.btn-ag-new-event:hover {
    background: var(--text-main) !important;
    color: #000000 !important;
    border-color: var(--text-main) !important;
}

.agenda-nav-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    justify-self: center;
}
.agenda-nav-btn {
    background: transparent !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: 2px !important;
    width: 30px !important;
    height: 30px !important;
    color: #888888 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.agenda-nav-btn:hover {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.28) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}
.agenda-mes-actual {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    margin: 0;
    letter-spacing: 2px;
    min-width: 165px;
    text-align: center;
}

.agenda-top-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 14px;
}
.btn-ag-today-jump {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #888888 !important;
    padding: 5px 10px !important;
    font-family: var(--font-mono) !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
    border-radius: 2px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-ag-today-jump:hover {
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}
.btn-cerrar-tablero {
    background: transparent !important;
    border: none !important;
    color: #888888 !important;
    cursor: pointer !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.2s ease;
}
.btn-cerrar-tablero:hover { color: #ffffff !important; }

.agenda-filter-topbar {
    position: relative;
    z-index: 9;
    height: 42px;
    min-height: 42px;
    flex: 0 0 42px;
    width: 100%;
    padding: 0 24px;
    background: #040404;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
.agenda-filter-topbar::-webkit-scrollbar { display: none; }

.ag-filtro-btn[data-filter-slug="todos"] {
    display: none !important;
}
.ag-filtro-btn,
.ag-filtro-btn:hover,
.ag-filtro-btn.activo {
    background: transparent !important;
    border: 1px solid transparent !important;
    padding: 5px 12px !important;
    margin: 0 !important;
    color: #999999 !important;
    border-radius: 2px !important;
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0.8px !important;
    cursor: default !important;
    pointer-events: none !important;
    user-select: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    outline: none !important;
    box-shadow: none !important;
    text-transform: uppercase !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}
.ag-filtro-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.agenda-main-stage {
    position: relative;
    z-index: 5;
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#agenda-render-area {
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.agenda-grid {
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: 30px;
    grid-auto-rows: 1fr;
    gap: 1px;
    background-color: rgba(255, 255, 255, 0.045);
    border-bottom: 1px solid rgba(255, 255, 255, 0.045);
    overflow: hidden;
}
.agenda-grid-header {
    background-color: #060606;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    color: #777777;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 12px;
    margin: 0;
}

.agenda-cell {
    background-color: var(--bg-surface);
    padding: 8px 10px;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    overflow: hidden;
    position: relative;
    transition: background-color 0.2s ease;
}
.agenda-cell:hover:not(.empty):not(.dia-pasado) { background-color: #0e0e0e; }
.agenda-cell.empty { background-color: #040404 !important; pointer-events: none; }
.agenda-cell.dia-pasado,
.agenda-cell.dia-pasado.is-cell-highlighted {
    background: #040404 !important;
    box-shadow: none !important;
    border-color: transparent !important;
    pointer-events: none;
}
.agenda-cell.dia-pasado .agenda-dia-numero,
.agenda-cell.dia-pasado .agenda-events-stack,
.agenda-cell.dia-pasado .ag-mob-dots {
    opacity: 0.22 !important;
    filter: grayscale(100%) !important;
}
.agenda-cell.dia-pasado .agenda-sticky {
    border-color: rgba(255, 255, 255, 0.05) !important;
    border-left-color: #444444 !important;
    background: #080808 !important;
}

.agenda-cell.is-today {
    background-color: #101010;
    box-shadow: inset 0 0 0 1px rgba(239, 239, 239, 0.35);
}
.agenda-cell-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    line-height: 1;
    margin-bottom: 2px;
}
.agenda-today-badge {
    font-size: 9px;
    font-weight: 800;
    color: #000000;
    background: var(--text-main);
    padding: 2px 5px;
    border-radius: 1px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.agenda-dia-numero {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 800;
    color: #555555;
    font-variant-numeric: tabular-nums;
}
.agenda-cell.has-events .agenda-dia-numero { color: #aaaaaa; }
.agenda-cell.is-today .agenda-dia-numero { color: #ffffff; font-weight: 900; }
.ag-mob-dots { display: none; }

.agenda-events-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.agenda-events-stack::-webkit-scrollbar { display: none; }

.agenda-sticky {
    position: relative;
    background: #121212 !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-left: 2px solid var(--ag-accent, #efefef) !important;
    border-radius: 1px !important;
    padding: 5px 8px !important;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-shrink: 0;
}
.agenda-sticky:hover:not(.is-locked-sticky) {
    background: #191919 !important;
    border-color: rgba(255, 255, 255, 0.24) !important;
    border-left-color: var(--ag-accent, #efefef) !important;
}
.agenda-sticky.is-destacado-sticky {
    background: #161616 !important;
    border-color: var(--ag-accent, #efefef) !important;
}
.agenda-sticky.is-locked-sticky { opacity: 0.55; cursor: default; }
.sticky-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    flex: 1 1 0%;
    pointer-events: none;
}
.sticky-time {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 800;
    color: var(--ag-accent, #aaaaaa);
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.sticky-title {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 800;
    color: var(--text-main) !important;
    line-height: 1.25;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ag-lock-svg { margin-right: 4px; vertical-align: -1px; opacity: 0.7; }
.sticky-del {
    background: transparent !important;
    border: none !important;
    color: #666666 !important;
    cursor: pointer !important;
    font-size: 13px !important;
    line-height: 1 !important;
    padding: 0 2px !important;
    outline: none !important;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}
.agenda-sticky:hover .sticky-del { opacity: 1; }
.sticky-del:hover { color: var(--accent-danger) !important; }

.agenda-cell.is-cell-highlighted {
    background: radial-gradient(circle at top right, var(--cell-hl-color, rgba(255, 255, 255, 0.08)), #0a0a0a 78%) !important;
    box-shadow: inset 0 0 0 1px var(--cell-hl-border, rgba(255, 255, 255, 0.28)) !important;
}
.agenda-cell.is-cell-highlighted .agenda-dia-numero { color: #ffffff !important; }

#agenda-mob-day-inspector { display: none; }

@media (max-width: 991px) {
    #proyd-agenda-overlay {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: calc(var(--bottom-nav-h) + var(--safe-bottom)) !important;
        height: calc(100vh - var(--bottom-nav-h) - var(--safe-bottom)) !important;
        height: calc(100dvh - var(--bottom-nav-h) - var(--safe-bottom)) !important;
        z-index: var(--z-overlay-view) !important;
    }
    .agenda-top-header {
        height: 54px !important;
        min-height: 54px !important;
        flex: 0 0 54px !important;
        padding: 0 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }
    .agenda-top-left { gap: 8px !important; }
    .tablero-title { font-size: 13px !important; letter-spacing: 1.5px !important; }
    .btn-ag-new-event { padding: 6px 10px !important; font-size: 12px !important; }
    .btn-ag-new-event span { display: none !important; }
    .agenda-nav-bar { gap: 8px !important; flex: 1 1 auto !important; justify-content: center !important; }
    .agenda-nav-btn { width: 36px !important; height: 36px !important; border-color: rgba(255, 255, 255, 0.14) !important; color: var(--text-main) !important; }
    .agenda-mes-actual { font-size: 13px !important; min-width: 132px !important; letter-spacing: 1.2px !important; cursor: pointer !important; }
    .agenda-top-right { gap: 6px !important; }
    .btn-ag-today-jump { padding: 7px 9px !important; font-size: 9.5px !important; }
    .btn-cerrar-tablero { width: 36px !important; height: 36px !important; padding: 0 !important; color: var(--text-main) !important; }
    .agenda-filter-topbar {
        height: auto !important;
        min-height: 40px !important;
        flex: 0 0 auto !important;
        padding: 7px 10px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        overflow-x: visible !important;
    }
    .ag-filtro-btn {
        padding: 5px 8px !important;
        font-size: 9.5px !important;
        letter-spacing: 0.5px !important;
        gap: 5px !important;
        border: 1px solid var(--border-subtle) !important;
        background: #080808 !important;
    }
    .ag-filtro-btn.activo {
        background: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.28) !important;
        color: #ffffff !important;
    }
    .ag-filtro-dot { width: 6px !important; height: 6px !important; }
    #agenda-render-area {
        flex: 0 0 55% !important;
        height: 55% !important;
        touch-action: pan-y;
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
    .agenda-grid { grid-template-rows: 24px; grid-auto-rows: 1fr; }
    .agenda-grid-header { justify-content: center; padding: 0; font-size: 9px; letter-spacing: 0.5px; }
    .agenda-cell { padding: 5px 4px !important; align-items: center !important; justify-content: space-between !important; cursor: pointer !important; }
    .agenda-cell.dia-pasado { pointer-events: auto !important; }
    .agenda-cell-top { width: 100%; justify-content: center; }
    .agenda-today-badge { display: none; }
    .agenda-dia-numero { font-size: 12px; text-align: center; }
    .agenda-cell.is-today .agenda-dia-numero { background: var(--text-main); color: #000000 !important; padding: 2px 5px; border-radius: 1px; }
    .agenda-cell.is-mob-selected { background-color: #141414 !important; box-shadow: inset 0 0 0 1px var(--text-main) !important; }
    .agenda-cell .agenda-events-stack { display: none !important; }
    .ag-mob-dots { display: flex !important; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; margin-bottom: 3px; }
    .ag-mob-dot-item { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
    #agenda-mob-day-inspector {
        display: flex !important;
        flex-direction: column;
        flex: 1 1 0%;
        min-height: 0;
        width: 100%;
        background: #050505;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 8;
        overflow: hidden;
        touch-action: pan-y;
    }
    .ag-mob-inspector-head {
        height: 36px;
        min-height: 36px;
        padding: 0 16px;
        background: #080808;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        display: flex;
        align-items: center;
        justify-content: space-between;
        font-size: 10px;
        font-weight: 800;
        color: #888888;
        letter-spacing: 1px;
        text-transform: uppercase;
    }
    #ag-mob-inspector-list {
        flex: 1 1 0%;
        min-height: 0;
        overflow-y: auto;
        padding: 12px 16px 18px 16px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.15s ease !important;
        will-change: transform, opacity;
    }
    #ag-mob-inspector-list .agenda-sticky { padding: 12px 14px !important; }
    #ag-mob-inspector-list .sticky-title { font-size: 12px !important; white-space: normal !important; }
    #ag-mob-inspector-list .sticky-time { font-size: 11px !important; }
    #ag-mob-inspector-list .sticky-del { opacity: 0.8 !important; }
}

#modal-nota-cuerpo a, .df-editor-visual a {
    color: #ffffff !important;
    font-weight: 800 !important;
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
}
.ag-spa-modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ag-spa-modal-box {
    background: #080808;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 2px solid var(--modal-accent, #efefef);
    border-radius: 2px;
    width: 100%;
    max-width: 500px;
    padding: 32px 30px;
    text-align: left;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
    color: var(--text-main);
    max-height: 90dvh;
    overflow-y: auto;
}
.ag-input-dark {
    background: #030303 !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    padding: 10px 12px !important;
    font-family: var(--font-mono) !important;
    font-size: 13px !important;
    outline: none !important;
    border-radius: 2px !important;
    width: 100%;
}
.ag-input-dark:focus { border-color: var(--border-focus) !important; }
.checkbox-destacado-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #aaaaaa;
    font-size: 11px;
    font-family: var(--font-mono);
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 9px 12px;
    border-radius: 2px;
    background: #030303;
}
