/* ==========================================
   MUSIC.IMPESOFT.COM STANDALONE STYLES
   ========================================== */
:root:has(.standalone-music) {
    color-scheme: light dark;
}

/* Background only on body so it doesn't double-render on body + .standalone-subsite container */
body:has(.standalone-music) {
    background-image: light-dark(url('/images/music.impesoft.com_2026_light.png'), url('/images/music.impesoft.com_2026_dark.png'));
    background-size: auto;
    background-position: center top -150px;
    background-repeat: no-repeat;
    background-color: light-dark(#ffffff, #000000);
    color: light-dark(#1f2937, #f3f4f6);
    font-family: 'Outfit', Arial, sans-serif;
    margin: 0;
    padding: 0;
    padding-bottom: 160px;
    text-align: center;
    min-height: 100vh;
}

.standalone-music {
    background: transparent;
    color: inherit;
    font-family: inherit;
    width: 100%;
}

.standalone-music h1,
.standalone-music h2,
.standalone-music h3,
.standalone-music h4 {
    font-family: 'Outfit', Arial, sans-serif;
}

.music-standalone-page {
    padding-top: 30px;
    position: relative;
    width: 100%;
    text-align: center;
}

.music-admin-floating-actions {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 500;
}

.music-upload-trigger {
    background: rgba(37, 99, 235, 0.9);
    color: #fff;
    border: 1px solid rgba(96, 165, 250, 0.5);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: all 0.2s ease;
}

.music-upload-trigger:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.player {
    min-width: 856px;
    max-width: max(856px, 80vw);
    margin: 0 auto;
    padding: 0;
    text-align: center;
    border-top: 2px solid light-dark(rgba(200, 200, 200, 0.5), rgba(99, 99, 99, 0.5));
    border-left: 2px solid light-dark(rgba(200, 200, 200, 0.5), rgba(99, 99, 99, 0.5));
    border-bottom: 2px solid light-dark(rgba(100, 100, 100, 0.5), rgb(0, 0, 0));
    border-right: 2px solid light-dark(rgba(100, 100, 100, 0.5), rgb(0, 0, 0));
    background-color: light-dark(rgba(240, 240, 240, 0.95), rgba(50, 50, 50, 0.8));
    color: light-dark(#111827, #ffffff);
    box-shadow: 1px 1px 2px light-dark(rgba(0, 0, 0, 0.15), black), 0 0 25px light-dark(rgba(59, 130, 246, 0.3), blue), 0 0 5px light-dark(rgba(30, 64, 175, 0.3), darkblue);
    height: min-content;
}

.player video {
    max-width: 100%;
    min-height: fit-content;
    height: 480px;
    display: block;
    margin: 0 auto;
}

.player-overlap {
    margin: 380px auto 0 auto;
    position: relative;
    z-index: 10;
}

.audioplayer {
    display: block;
    width: 100%;
    padding: 10px 0 4px 0;
    box-sizing: border-box;
}

.audioplayer h2 {
    margin: 12px 0 56px 0;
    font-size: 1.2rem;
    font-weight: 400;
    color: light-dark(#4b5563, #9ca3af);
}

/* Fixed Bottom Player Header */
.player-header {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    background-color: light-dark(rgba(240, 240, 240, 0.95), rgba(15, 23, 42, 0.95));
    padding: 0;
    border-top: 1px solid light-dark(rgba(200, 200, 200, 0.2), rgba(255, 255, 255, 0.08));
    margin-bottom: 0;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.player-header > .controls,
.player-header .controls {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2px 24px;
    box-sizing: border-box;
    position: relative;
}

.player-header .control-buttons {
    grid-row: 1;
    grid-column: 1;
    justify-self: start;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.player-header .track-title {
    grid-row: 1;
    grid-column: 2;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: light-dark(#111827, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    padding: 0 12px;
}

.player-header .time-info {
    grid-row: 1;
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    font-size: 14px;
    color: light-dark(#4b5563, #ccc);
    font-family: Arial, sans-serif;
    font-variant-numeric: tabular-nums;
}

/* arcade.css has an unscoped `.controls span` rule (bold, 1.2rem) that would otherwise inflate the time display */
.player-header .time-info span {
    font-size: inherit;
    font-weight: inherit;
}

.standalone-music .player-header .controls button.control-btn {
    background: none;
    border: none;
    box-shadow: none;
    color: light-dark(#4b5563, #ccc);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.1s ease;
    padding: 8px;
    border-radius: 50%;
    width: auto;
    height: auto;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.standalone-music .player-header .controls button.control-btn:hover {
    color: light-dark(#111827, #ffffff);
    background: light-dark(rgba(0, 0, 0, 0.05), rgba(255, 255, 255, 0.08));
    transform: none;
    box-shadow: none;
}

.standalone-music .player-header .controls button.control-btn:active {
    transform: scale(0.95);
}

.standalone-music .player-header .controls button.control-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: block;
    margin: auto;
}

.standalone-music .player-header .controls button.play-pause-btn {
    width: 40px;
    height: 40px;
    padding: 6px;
    border: 1.5px solid light-dark(#4b5563, rgba(255, 255, 255, 0.45));
    color: light-dark(#111827, #ffffff);
}

.standalone-music .player-header .controls button.play-pause-btn:hover {
    border-color: #58a6ff;
    background: rgba(88, 166, 255, 0.15);
    color: #ffffff;
}

.standalone-music .player-header .controls button.play-pause-btn svg {
    width: 22px;
    height: 22px;
}

.seek-bar-container {
    position: relative;
    margin: 0;
    padding: 0;
    height: 60px;
    display: flex;
    align-items: center;
    background: light-dark(rgba(250, 250, 250, 0.75), rgba(13, 17, 23, 0.75));
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    overflow: hidden;
}

#waveformImage {
    width: 100%;
    height: 100%;
    object-fit: fill;
    display: block;
    filter: light-dark(invert(1) hue-rotate(180deg) opacity(0.75), saturate(2.5) brightness(1.8));
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 100%;
    background: transparent;
    outline: none;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 3px;
    height: 60px;
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.slider::-moz-range-thumb {
    width: 3px;
    height: 60px;
    background: #ffffff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* Playlist */
.playlist {
    margin-top: 8px;
    padding: 0 10px;
}

.playlist-tracks {
    list-style: none;
    padding: 0;
    margin: 0;
}

.playlist-track {
    --cover-scale: 0.9;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 12px;
    margin-bottom: 16px;
    background-color: light-dark(#e5e7eb, #0d1117);
    border: 1px solid light-dark(#d1d5db, #30363d);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.playlist-track:hover,
.playlist-track.active {
    --cover-scale: 1;
    background-color: light-dark(#f3f4f6, #161b22);
    border-color: #58a6ff;
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.2);
}

/* Cover Section */
.track-cover-container {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    background-color: light-dark(#f3f4f6, #121212);
    flex-shrink: 0;
    margin-right: 20px;
}

.track-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms ease;
    transform: scale(var(--cover-scale));
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #58a6ff;
    color: #fff;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.playlist-track:hover .play-overlay,
.playlist-track.active .play-overlay {
    opacity: 1;
}

.play-icon {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

/* Info Section */
.track-info-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 400px;
    flex-shrink: 0;
    min-width: 0;
}

.track-info-section .track-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: light-dark(#111827, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-track.active .track-info-section .track-title {
    color: light-dark(#2563eb, #58a6ff);
}

.track-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: light-dark(#6b7280, #8b949e);
    margin-top: 8px;
    margin-bottom: 8px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item svg {
    color: light-dark(#9ca3af, #8b949e);
}

.track-tags {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.track-tag {
    background-color: #9e4a1a;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Waveform Section */
.track-waveform-section {
    flex-grow: 1;
    height: 40px;
    display: flex;
    align-items: center;
    margin: 0 20px;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.track-waveform-container {
    position: relative;
    width: 100%;
    height: 40px;
    overflow: hidden;
}

.track-waveform {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.base-waveform {
    filter: light-dark(invert(1) hue-rotate(180deg) saturate(0.75), saturate(0.75) brightness(1));
}

.progress-waveform {
    filter: light-dark(invert(1) hue-rotate(180deg) saturate(1.5), saturate(2) brightness(1.4));
    clip-path: polygon(0 0, var(--progress, 0%) 0, var(--progress, 0%) 100%, 0 100%);
    transition: clip-path 0.1s linear;
}

/* Actions Section */
.track-actions-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    width: 120px;
    flex-shrink: 0;
    height: 100px;
}

.track-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: light-dark(#6b7280, #8b949e);
    text-decoration: none;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
}

.action-link:hover {
    color: #58a6ff;
}

.edit-link {
    color: #58a6ff;
}

.track-time-floating {
    font-size: 0.85rem;
    color: light-dark(#6b7280, #8b949e);
    margin-top: auto;
    font-variant-numeric: tabular-nums;
}

/* Footer */
.music-standalone-footer {
    margin-top: 2rem;
    color: light-dark(#374151, #9ca3af);
}

/* Edit Track Standalone Card */
.edit-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    min-height: 80vh;
}

.edit-card {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    color: #e0e0e0;
    text-align: left;
}

.edit-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #333;
    padding-bottom: 0.75rem;
}

.edit-card h3 {
    margin: 0;
    color: #fff;
    font-size: 1.5rem;
}

.edit-card .form-group {
    margin-bottom: 1.25rem;
}

.edit-card .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #aaa;
    font-size: 0.9rem;
}

.edit-card .form-control {
    width: 100%;
    padding: 10px 12px;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.edit-card .form-control:focus {
    outline: none;
    border-color: #007bff;
}

.edit-card .form-control:disabled {
    background-color: #151515;
    color: #666;
    cursor: not-allowed;
}

.edit-card .filename-control-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.edit-card .filename-control-row .form-control {
    flex: 1;
    min-width: 0;
}

.edit-card .filename-action-btn {
    white-space: nowrap;
    flex-shrink: 0;
}

.edit-card .rename-s3-box {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: #171717;
    border: 1px solid #333;
    border-radius: 6px;
}

.edit-card .alert-success {
    background-color: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
    padding: 0.6rem 0.85rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.cover-preview {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #444;
    background-color: #121212;
}

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

.edit-card .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
    flex-wrap: wrap;
}

.nav-save-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.standalone-music .btn-primary,
.music-standalone-page .btn-primary,
.standalone-music .btn-secondary,
.music-standalone-page .btn-secondary {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.standalone-music .btn-primary,
.music-standalone-page .btn-primary {
    background-color: #007bff;
    color: white;
}

.standalone-music .btn-primary:hover:not(:disabled),
.music-standalone-page .btn-primary:hover:not(:disabled) {
    background-color: #0056b3;
}

.standalone-music .btn-secondary,
.music-standalone-page .btn-secondary {
    background-color: #333;
    color: #ccc;
}

.standalone-music .btn-secondary:hover:not(:disabled),
.music-standalone-page .btn-secondary:hover:not(:disabled) {
    background-color: #444;
    color: #fff;
}

.standalone-music .btn-primary:disabled,
.music-standalone-page .btn-primary:disabled,
.standalone-music .btn-secondary:disabled,
.music-standalone-page .btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* File Uploader View */
.upload-view-wrapper {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
}

.upload-view-back {
    text-align: left;
    margin-bottom: 16px;
}

.uploader-container {
    text-align: left;
}

.uploader-card {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    color: #e0e0e0;
}

.dropzone {
    border: 2px dashed #3b82f6;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    background: rgba(30, 41, 59, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.25rem;
}

.dropzone:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: #60a5fa;
}

.dropzone input[type="file"] {
    display: none;
}

.dropzone-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: #e2e8f0;
    font-weight: 500;
}

.upload-icon {
    width: 48px;
    height: 48px;
    fill: #60a5fa;
}

.canvas-container {
    margin-top: 1.25rem;
    padding: 1rem;
    background: #121212;
    border-radius: 8px;
    border: 1px solid #333;
}

#waveformCanvas {
    width: 100%;
    height: 100px;
    display: block;
}

.progress-container {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-container progress {
    flex: 1;
    height: 12px;
}

/* Responsive adjustments */
@media screen and (max-width: 1080px) {
    body:has(.standalone-music) {
        background-size: contain !important;
        background-position: center top !important;
        padding-bottom: 200px;
    }

    .standalone-music {
        background: transparent !important;
    }

    .player {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border: none;
        box-shadow: none;
        background: transparent;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .player-overlap {
        margin-top: 240px;
    }

    .audioplayer {
        width: 100%;
        box-sizing: border-box;
        padding: 0;
    }

    .audioplayer h2 {
        display: none;
    }

    #video {
        width: 100%;
        height: auto;
    }

    .player-header {
        display: flex;
        flex-direction: column-reverse;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background-color: rgba(15, 23, 42, 0.95);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 1000;
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.5);
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    }

    .player-header .controls {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 8px 12px;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .player-header .track-title {
        font-size: 16px;
        font-weight: 600;
        text-align: center;
        margin: 0;
        width: 90%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #fff;
        padding: 0;
    }

    .player-header .time-info {
        margin: 0;
        font-size: 13px;
        color: #aaa;
        justify-content: center;
    }

    .player-header .control-buttons {
        position: relative;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 32px;
        margin-top: 5px;
    }

    .standalone-music .player-header .controls button.control-btn {
        width: 56px;
        height: 56px;
        padding: 10px;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .standalone-music .player-header .controls button.control-btn svg {
        width: 30px;
        height: 30px;
        fill: #ccc;
    }

    .standalone-music .player-header .controls button.control-btn:hover svg {
        fill: #fff;
    }

    .standalone-music .player-header .controls button.play-pause-btn {
        width: 68px;
        height: 68px;
        background: #3b82f6;
        border: none;
    }

    .standalone-music .player-header .controls button.play-pause-btn svg {
        width: 36px;
        height: 36px;
        fill: #ffffff;
    }

    .seek-bar-container {
        height: 50px;
    }

    .slider::-webkit-slider-thumb,
    .slider::-moz-range-thumb {
        height: 50px;
    }
}

@media screen and (max-width: 856px) {
    .playlist-track {
        padding: 10px;
    }

    .track-cover-container {
        width: 70px;
        height: 70px;
        margin-right: 12px;
    }

    .play-overlay {
        width: 36px;
        height: 36px;
    }

    .track-info-section {
        width: auto;
        flex: 1;
        min-width: 0;
    }

    .track-info-section .track-title {
        font-size: 1.1rem;
        text-align: left;
    }

    .track-waveform-section,
    .track-meta,
    .track-time-floating {
        display: none !important;
    }

    .track-actions-section {
        width: auto;
        height: auto;
        justify-content: center;
        margin-left: 12px;
    }

    .track-actions {
        flex-direction: column;
        gap: 20px;
    }
}

@media screen and (max-width: 480px) {
    .track-tags {
        display: none !important;
    }

    .track-info-section .track-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}