/* ============================================================================
   AUDIO PLAYER FLOTANTE — Reproductor de música ambiente
   ============================================================================ */

.audio-player {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9000;
    font-family: 'Inter', 'Sora', sans-serif;
}

/* Botón circular flotante (siempre visible) */
.audio-toggle {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7C3AED 0%, #A855F7 60%, #EC4899 100%);
    color: #FFFFFF;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow:
        0 12px 30px rgba(124, 58, 237, 0.45),
        0 0 0 1px rgba(168, 85, 247, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: audio-pulse 3s ease-in-out infinite;
}

.audio-toggle:hover {
    transform: scale(1.08) rotate(8deg);
    box-shadow:
        0 16px 38px rgba(124, 58, 237, 0.6),
        0 0 0 2px rgba(168, 85, 247, 0.6);
}

.audio-toggle.playing {
    animation: audio-pulse-fast 1.4s ease-in-out infinite;
}

.audio-toggle.playing::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(168, 85, 247, 0.5);
    animation: audio-ring 1.6s ease-out infinite;
}

@keyframes audio-pulse {
    0%, 100% { box-shadow: 0 12px 30px rgba(124, 58, 237, 0.45), 0 0 0 1px rgba(168, 85, 247, 0.4); }
    50%      { box-shadow: 0 16px 36px rgba(124, 58, 237, 0.65), 0 0 0 1px rgba(168, 85, 247, 0.6), 0 0 0 8px rgba(168, 85, 247, 0.15); }
}

@keyframes audio-pulse-fast {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

@keyframes audio-ring {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Panel expandible con controles */
.audio-panel {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 320px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 18px;
    padding: 18px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(168, 85, 247, 0.2);
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.audio-player.expanded .audio-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.audio-info {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.audio-track-name {
    font-family: 'Sora', sans-serif;
    font-size: 14.5px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 3px;
    letter-spacing: -0.01em;
}

.audio-track-sub {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.02em;
}

.audio-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 14px;
}

.audio-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.audio-btn:hover {
    background: rgba(168, 85, 247, 0.18);
    border-color: rgba(168, 85, 247, 0.5);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.audio-btn-main {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, #7C3AED, #A855F7);
    border-color: rgba(168, 85, 247, 0.6);
    color: #FFFFFF;
    font-size: 15px;
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.audio-btn-main:hover {
    background: linear-gradient(135deg, #6D28D9, #9333EA);
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.55);
}

.audio-btn.muted {
    color: #EF4444;
    border-color: rgba(239, 68, 68, 0.4);
}

/* Barra de progreso */
.audio-progress {
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.audio-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7C3AED, #A855F7, #EC4899);
    border-radius: 100px;
    width: 0%;
    transition: width 0.15s linear;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* ============ DAY MODE ============ */
body.day-mode .audio-panel {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(124, 58, 237, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(124, 58, 237, 0.1);
}

body.day-mode .audio-track-name { color: #111827; }
body.day-mode .audio-track-sub { color: #6B7280; }

body.day-mode .audio-btn {
    background: #F9FAFB;
    border-color: #E5E7EB;
    color: #4B5563;
}

body.day-mode .audio-btn:hover {
    background: rgba(124, 58, 237, 0.08);
    border-color: #7C3AED;
    color: #7C3AED;
}

body.day-mode .audio-progress {
    background: #E5E7EB;
}

body.day-mode .audio-info {
    border-bottom-color: #E5E7EB;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
    .audio-player {
        bottom: 16px;
        left: 16px;
    }
    .audio-toggle {
        width: 50px;
        height: 50px;
        font-size: 19px;
    }
    .audio-panel {
        width: calc(100vw - 32px);
        max-width: 300px;
    }
}

/* ============================================================================
   PREVIEW MODAL — Lightbox para certificados y arquitectos
   ============================================================================ */
.preview-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: pm-fadein 0.25s ease;
}

.preview-modal[hidden] { display: none !important; }

@keyframes pm-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}

.pm-close, .pm-prev, .pm-next {
    position: fixed;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    font-size: 19px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
    z-index: 2;
}

.pm-close { top: 24px; right: 24px; }
.pm-prev  { left: 24px; top: 50%; transform: translateY(-50%); }
.pm-next  { right: 24px; top: 50%; transform: translateY(-50%); }

.pm-close:hover, .pm-prev:hover, .pm-next:hover {
    background: rgba(168, 85, 247, 0.4);
    border-color: #A855F7;
    transform: scale(1.08);
}

.pm-prev:hover { transform: translateY(-50%) scale(1.08); }
.pm-next:hover { transform: translateY(-50%) scale(1.08); }

.pm-content {
    max-width: 1100px;
    width: 100%;
    max-height: 88vh;
    background: linear-gradient(160deg, #1A1F2E 0%, #0F172A 100%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 24px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    animation: pm-zoomin 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pm-zoomin {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.pm-media {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 400px;
    max-height: 88vh;
}

.pm-media img {
    max-width: 100%;
    max-height: 88vh;
    object-fit: contain;
    display: block;
}

.pm-media iframe,
.pm-media embed {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
}

.pm-info {
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, transparent 0%, rgba(168, 85, 247, 0.04) 100%);
    overflow-y: auto;
}

.pm-issuer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 100px;
    color: #C4B5FD;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    align-self: flex-start;
    margin-bottom: 16px;
}

.pm-title {
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: #FFFFFF;
    margin: 0 0 14px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.pm-desc {
    font-size: 14.5px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.75);
    margin: 0 0 24px;
}

.pm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pm-action {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 12px;
    font-family: 'Sora', 'Inter', sans-serif;
    font-weight: 600;
    font-size: 13.5px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.pm-action-primary {
    background: linear-gradient(135deg, #7C3AED, #A855F7);
    color: #FFFFFF;
    box-shadow: 0 8px 22px rgba(124, 58, 237, 0.4);
}

.pm-action-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.55);
}

.pm-action-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
}

.pm-action-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Day mode */
body.day-mode .pm-content {
    background: #FFFFFF;
    border-color: #E5E7EB;
}

body.day-mode .pm-info { background: #FAFAFA; }
body.day-mode .pm-title { color: #111827; }
body.day-mode .pm-desc { color: #4B5563; }

body.day-mode .pm-issuer {
    background: rgba(124, 58, 237, 0.08);
    border-color: #A855F7;
    color: #7C3AED;
}

body.day-mode .pm-action-secondary {
    background: #FFFFFF;
    border-color: #D1D5DB;
    color: #374151;
}

body.day-mode .pm-action-secondary:hover {
    background: #F9FAFB;
    border-color: #A855F7;
    color: #7C3AED;
}

/* Responsive */
@media (max-width: 880px) {
    .preview-modal { padding: 20px 12px; }
    .pm-content {
        grid-template-columns: 1fr;
        max-height: 92vh;
        overflow-y: auto;
    }
    .pm-media { min-height: 280px; max-height: 50vh; }
    .pm-info { padding: 24px 20px; }
    .pm-title { font-size: 21px; }
    .pm-close { top: 14px; right: 14px; width: 44px; height: 44px; }
    .pm-prev  { left: 8px;  width: 40px; height: 40px; }
    .pm-next  { right: 8px; width: 40px; height: 40px; }
}

/* Hint para clickable cards */
.is-clickable {
    cursor: pointer;
}

.is-clickable::after {
    content: '\f00e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.15);
    color: #A855F7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: 5;
}

.is-clickable:hover::after {
    opacity: 1;
}
