/* ══════════════════════════════════════════════
   OpenTune Web — Custom Styles
   Complementa Tailwind CSS con estilos glassmórficos,
   dialogs, animaciones y componentes personalizados.
   ══════════════════════════════════════════════ */

/* ─── Base ─── */
html {
    scroll-behavior: smooth;
}

*, ::before, ::after {
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

/* ─── Material Symbols ─── */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

/* ─── Glass Card ─── */
.glass-card {
    background: rgba(20, 19, 23, 0.45);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ─── Ambient Glow ─── */
.ambient-glow {
    box-shadow: 0 0 40px 0 rgba(208, 188, 255, 0.15);
}

/* ─── Feature Icon Wrapper ─── */
.feature-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

/* ─── Version Chips ─── */
.version-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    background-color: rgba(43, 41, 45, 0.8);
    color: #cac4d0;
    font-size: 11px;
    font-weight: 500;
    font-family: 'Be Vietnam Pro', sans-serif;
    line-height: 16px;
}

.version-chip--stable {
    background-color: rgba(239, 184, 200, 0.18);
    color: #ffd9e3;
}

.version-chip--beta {
    background-color: rgba(74, 67, 89, 0.6);
    color: #ccc2dc;
}

.version-chip--alpha {
    background-color: rgba(208, 188, 255, 0.15);
    color: #e9ddff;
}

.version-chip--latest {
    background-color: rgba(208, 188, 255, 0.18);
    color: #d0bcff;
}

/* ─── Footer Chips ─── */
.footer-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 9999px;
    border: 1px solid rgba(73, 69, 79, 0.5);
    color: #948f9a;
    font-size: 13px;
    font-family: 'Be Vietnam Pro', sans-serif;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.footer-chip:hover {
    border-color: rgba(208, 188, 255, 0.4);
    color: #d0bcff;
    background: rgba(208, 188, 255, 0.07);
    transform: translateY(-1px);
}

/* ─── Developer Chip Animation ─── */
.developer-chip {
    animation: shine 3.5s ease-in-out infinite;
}

@keyframes shine {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.8; transform: scale(1.04); }
}

/* ══════════════════════════════════════════════
   GLASS DIALOGS
   ══════════════════════════════════════════════ */

.glass-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(90vw, 480px);
    max-height: 85vh;
    border: none;
    border-radius: 2rem;
    background: rgba(18, 17, 22, 0.88);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e5e1e7;
    overflow: hidden;
    padding: 0;
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(208, 188, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-dialog--large {
    width: min(90vw, 600px);
}

.glass-dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Dialog layout */
.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 0;
    gap: 12px;
}

.dialog-content {
    padding: 20px 24px;
}

.dialog-content--scroll {
    overflow-y: auto;
    max-height: 58vh;
}

.dialog-content--scroll::-webkit-scrollbar {
    width: 4px;
}
.dialog-content--scroll::-webkit-scrollbar-track {
    background: transparent;
}
.dialog-content--scroll::-webkit-scrollbar-thumb {
    background: rgba(208, 188, 255, 0.25);
    border-radius: 2px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 24px 24px;
}

/* Dialog buttons */
.dialog-icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: #cac4d0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.dialog-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.dialog-text-btn {
    background: transparent;
    border: none;
    color: #d0bcff;
    font-family: 'Be Vietnam Pro', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
}

.dialog-text-btn:hover {
    background: rgba(208, 188, 255, 0.1);
}

.dialog-filled-btn {
    background: #d0bcff;
    border: none;
    color: #37265e;
    font-family: 'Be Vietnam Pro', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 24px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
}

.dialog-filled-btn:hover {
    filter: brightness(1.1);
}

.dialog-filled-btn:active {
    transform: scale(0.96);
}

/* Dialog list items (language) */
.dialog-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 1rem;
    color: #e5e1e7;
    font-family: 'Be Vietnam Pro', sans-serif;
    transition: background 0.2s;
    cursor: pointer;
}

.dialog-list-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.flag-icon {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════
   LOADING INDICATOR
   ══════════════════════════════════════════════ */

.loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 56px 40px;
}

.circular-progress {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(208, 188, 255, 0.18);
    border-top: 3px solid #d0bcff;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════
   MARKDOWN BODY (changelog)
   ══════════════════════════════════════════════ */

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    color: #e5e1e7;
    font-family: 'Epilogue', sans-serif;
    margin: 20px 0 10px;
}

.markdown-body h1 { font-size: 1.4rem; font-weight: 700; }
.markdown-body h2 { font-size: 1.15rem; font-weight: 600; }
.markdown-body h3 { font-size: 1rem; font-weight: 600; }

.markdown-body p {
    color: #cac4d0;
    line-height: 1.75;
    margin: 8px 0;
}

.markdown-body ul,
.markdown-body ol {
    color: #cac4d0;
    padding-left: 22px;
    margin: 8px 0;
    line-height: 1.75;
}

.markdown-body li {
    margin: 4px 0;
}

.markdown-body code {
    background: rgba(208, 188, 255, 0.12);
    color: #d0bcff;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.82em;
    font-family: ui-monospace, 'Courier New', monospace;
}

.markdown-body pre {
    background: rgba(14, 14, 17, 0.7);
    border: 1px solid rgba(73, 69, 79, 0.4);
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: #e5e1e7;
}

.markdown-body a {
    color: #d0bcff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.markdown-body a:hover {
    color: #e9ddff;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid rgba(73, 69, 79, 0.5);
    margin: 20px 0;
}

/* Changelog meta header */
.changelog-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(73, 69, 79, 0.4);
}

.changelog-date {
    font-size: 13px;
    color: #948f9a;
    font-family: 'Be Vietnam Pro', sans-serif;
}

/* ══════════════════════════════════════════════
   VERSION LIST (versions dialog)
   ══════════════════════════════════════════════ */

.version-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 12px;
    border-bottom: 1px solid rgba(73, 69, 79, 0.3);
}

.version-list-item:last-child {
    border-bottom: none;
}

.version-list-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.version-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.version-tag {
    font-size: 15px;
    font-weight: 500;
    color: #e5e1e7;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.version-date {
    font-size: 12px;
    color: #948f9a;
    font-family: 'Be Vietnam Pro', sans-serif;
}

.version-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(43, 41, 45, 0.8);
    color: #e5e1e7;
    border: 1px solid rgba(73, 69, 79, 0.4);
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Be Vietnam Pro', sans-serif;
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.version-dl-btn:hover {
    background: rgba(53, 52, 56, 0.9);
    border-color: rgba(208, 188, 255, 0.3);
    color: #d0bcff;
}

/* ══════════════════════════════════════════════
   DISABLED CARD (Windows)
   ══════════════════════════════════════════════ */

.disabled-card {
    position: relative;
    overflow: hidden;
    cursor: not-allowed;
    user-select: none;
    -webkit-user-select: none;
}

/* Diagonal stripe overlay */
.disabled-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 14px,
        rgba(255, 255, 255, 0.018) 14px,
        rgba(255, 255, 255, 0.018) 28px
    );
    pointer-events: none;
    z-index: 0;
}

.disabled-card__inner {
    position: relative;
    z-index: 1;
    opacity: 0.5;
    pointer-events: none;
}

/* ══════════════════════════════════════════════
   SCROLLBAR (global)
   ══════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(208, 188, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(208, 188, 255, 0.38);
}

/* ══════════════════════════════════════════════
   FOCUS VISIBLE
   ══════════════════════════════════════════════ */

:focus-visible {
    outline: 2px solid #d0bcff;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ══════════════════════════════════════════════
   LIGHT MODE OVERRIDES
   (activa con root.classList.add('light-mode'))
   ══════════════════════════════════════════════ */

:root.light-mode {
    --lm-bg:           #FEF7FF;
    --lm-on-bg:        #1D1B20;
    --lm-surface:      #FEF7FF;
    --lm-on-surface:   #1D1B20;
    --lm-sc-low:       #F7F2FA;
    --lm-sc:           #F3EDF7;
    --lm-sc-high:      #ECE6F0;
    --lm-sc-highest:   #E6E0E9;
    --lm-primary:      #6750A4;
    --lm-on-primary:   #FFFFFF;
    --lm-pc:           #EADDFF;
    --lm-on-pc:        #21005D;
    --lm-sec-c:        #E8DEF8;
    --lm-on-sec-c:     #1D192B;
    --lm-on-sv:        #49454F;
    --lm-ov:           #CAC4D0;
}

:root.light-mode body {
    background-color: var(--lm-bg);
    color: var(--lm-on-bg);
}

:root.light-mode .bg-background    { background-color: var(--lm-bg) !important; }
:root.light-mode .bg-surface       { background-color: var(--lm-surface) !important; }
:root.light-mode .bg-surface-container-lowest { background-color: var(--lm-sc-low) !important; }
:root.light-mode .bg-surface-container-high   { background-color: var(--lm-sc-high) !important; }
:root.light-mode .bg-surface-container-highest{ background-color: var(--lm-sc-highest) !important; }
:root.light-mode .bg-primary-container        { background-color: var(--lm-pc) !important; }
:root.light-mode .bg-secondary-container      { background-color: var(--lm-sec-c) !important; }
:root.light-mode .bg-primary       { background-color: var(--lm-primary) !important; }

:root.light-mode .text-on-surface         { color: var(--lm-on-surface) !important; }
:root.light-mode .text-on-surface-variant { color: var(--lm-on-sv) !important; }
:root.light-mode .text-on-background      { color: var(--lm-on-bg) !important; }
:root.light-mode .text-on-primary         { color: var(--lm-on-primary) !important; }
:root.light-mode .text-on-primary-container { color: var(--lm-on-pc) !important; }
:root.light-mode .text-on-secondary-container { color: var(--lm-on-sec-c) !important; }
:root.light-mode .text-primary            { color: var(--lm-primary) !important; }
:root.light-mode .text-violet-300         { color: var(--lm-primary) !important; }
:root.light-mode .text-slate-400          { color: var(--lm-on-sv) !important; }
:root.light-mode .text-slate-500          { color: #79747E !important; }
:root.light-mode .text-slate-100          { color: var(--lm-on-surface) !important; }
:root.light-mode .text-surface            { color: var(--lm-surface) !important; }

:root.light-mode .border-outline-variant  { border-color: var(--lm-ov) !important; }
:root.light-mode .border-white\/10        { border-color: rgba(0, 0, 0, 0.08) !important; }
:root.light-mode .border-white\/5         { border-color: rgba(0, 0, 0, 0.05) !important; }

:root.light-mode .bg-slate-950\/65 { background-color: rgba(254, 247, 255, 0.82) !important; }
:root.light-mode .bg-slate-950     { background-color: #F7F2FA !important; }

:root.light-mode .glass-card {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.06);
}

:root.light-mode .glass-dialog {
    background: rgba(240, 236, 248, 0.92);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1D1B20;
}

:root.light-mode .glass-dialog::backdrop {
    background: rgba(0, 0, 0, 0.42);
}

:root.light-mode .dialog-text-btn  { color: var(--lm-primary); }
:root.light-mode .dialog-text-btn:hover { background: rgba(103, 80, 164, 0.1); }
:root.light-mode .dialog-icon-btn   { color: var(--lm-on-sv); }
:root.light-mode .dialog-icon-btn:hover { background: rgba(0,0,0,0.06); }
:root.light-mode .dialog-list-item  { color: var(--lm-on-surface); }
:root.light-mode .dialog-list-item:hover { background: rgba(0,0,0,0.05); }
:root.light-mode .dialog-filled-btn { background: var(--lm-primary); color: var(--lm-on-primary); }

:root.light-mode .footer-chip {
    border-color: rgba(0, 0, 0, 0.12);
    color: #49454F;
}
:root.light-mode .footer-chip:hover {
    border-color: var(--lm-primary);
    color: var(--lm-primary);
    background: rgba(103, 80, 164, 0.06);
}

:root.light-mode .circular-progress {
    border-color: rgba(103, 80, 164, 0.18);
    border-top-color: var(--lm-primary);
}

:root.light-mode .version-chip {
    background-color: rgba(231, 224, 236, 0.9);
    color: #49454F;
}

:root.light-mode .version-dl-btn {
    background: rgba(231, 224, 236, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1D1B20;
}
:root.light-mode .version-dl-btn:hover {
    border-color: var(--lm-primary);
    color: var(--lm-primary);
}

:root.light-mode .markdown-body h1,
:root.light-mode .markdown-body h2,
:root.light-mode .markdown-body h3 { color: #1D1B20; }
:root.light-mode .markdown-body p,
:root.light-mode .markdown-body li  { color: #49454F; }
:root.light-mode .markdown-body code {
    background: rgba(103, 80, 164, 0.1);
    color: var(--lm-primary);
}
:root.light-mode .markdown-body a   { color: var(--lm-primary); }

:root.light-mode .ambient-glow {
    box-shadow: 0 0 40px 0 rgba(103, 80, 164, 0.18);
}

:root.light-mode .from-surface {
    --tw-gradient-from: #FEF7FF var(--tw-gradient-from-position);
}

/* ══════════════════════════════════════════════
   ACCESSIBILITY & PERFORMANCE
   ══════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    .glass-card {
        border-width: 2px;
        border-color: rgba(255, 255, 255, 0.25);
    }
    .glass-dialog {
        border-width: 2px;
    }
}

/* ══════════════════════════════════════════════
   RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

@media (max-width: 640px) {
    .glass-dialog {
        width: 92vw;
        border-radius: 1.5rem;
        max-height: 88vh;
    }

    .dialog-header {
        padding: 20px 18px 0;
    }

    .dialog-content {
        padding: 16px 18px;
    }

    .dialog-actions {
        padding: 0 18px 20px;
    }
}

@media (max-width: 480px) {
    .version-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .version-dl-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ─── Screenshots Accordion ─── */
#screenshots-content {
    max-height: 2000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s ease,
                margin 0.3s ease;
}

#screenshots-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
    margin: 0;
    padding: 0;
}

#screenshots-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#screenshots-icon.rotated {
    transform: rotate(180deg);
}

#screenshots-header:hover #screenshots-toggle {
    background: rgba(255, 255, 255, 0.08);
}

    @keyframes spin {
      to { transform: rotate(360deg); }
    }