/* MusicHub.app — dark theme, Montserrat + Rubik, small rounded corners */

:root,
[data-bs-theme="dark"] {
    --mh-bg: #0d0f14;
    --mh-bg-elev-1: #161922;
    --mh-bg-elev-2: #1d212c;
    --mh-border: rgba(255, 255, 255, 0.08);
    --mh-border-strong: rgba(255, 255, 255, 0.14);
    --mh-text: #e6e8ec;
    --mh-text-muted: #98a0ad;
    --mh-text-subtle: #6c7484;

    --mh-primary: #8b5cf6;
    --mh-primary-hover: #a78bfa;
    --mh-primary-soft: rgba(139, 92, 246, 0.16);
    --mh-success: #22c55e;
    --mh-danger: #ef4444;

    --mh-radius-sm: 4px;
    --mh-radius: 6px;
    --mh-radius-lg: 10px;
    --mh-radius-pill: 999px;

    --mh-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.32);
    --mh-shadow-2: 0 6px 18px rgba(0, 0, 0, 0.42);

    --mh-font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mh-font-display: 'Rubik', 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;

    --bs-body-bg: var(--mh-bg);
    --bs-body-color: var(--mh-text);
    --bs-body-font-family: var(--mh-font-body);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.55;
    --bs-border-color: var(--mh-border);
    --bs-border-color-translucent: var(--mh-border);
    --bs-border-radius: var(--mh-radius);
    --bs-border-radius-sm: var(--mh-radius-sm);
    --bs-border-radius-lg: var(--mh-radius-lg);
    --bs-link-color: var(--mh-primary);
    --bs-link-hover-color: var(--mh-primary-hover);
    --bs-link-color-rgb: 139, 92, 246;
    --bs-link-hover-color-rgb: 167, 139, 250;
    --bs-primary: var(--mh-primary);
    --bs-primary-rgb: 139, 92, 246;
    --bs-secondary-color: var(--mh-text-muted);
    --bs-tertiary-bg: var(--mh-bg-elev-1);
    --bs-card-bg: var(--mh-bg-elev-1);
    --bs-card-border-color: var(--mh-border);
    --bs-card-cap-bg: transparent;
}

html, body {
    background-color: var(--mh-bg);
    color: var(--mh-text);
}
body {
    font-family: var(--mh-font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.card-title, .navbar-brand {
    font-family: var(--mh-font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--mh-text);
}
h1, .h1 { font-size: clamp(1.75rem, 1vw + 1.5rem, 2.25rem); }
h2, .h2 { font-size: 1.5rem; }
h3, .h3 { font-size: 1.25rem; }

a { color: var(--mh-primary); text-decoration: none; transition: color .15s ease-out; }
a:hover { color: var(--mh-primary-hover); }

.text-muted { color: var(--mh-text-muted) !important; }
.bg-light { background-color: var(--mh-bg-elev-1) !important; }
.bg-dark, .bg-black { background-color: var(--mh-bg) !important; }

::selection { background: var(--mh-primary-soft); color: var(--mh-text); }

:focus-visible {
    outline: 2px solid var(--mh-primary);
    outline-offset: 2px;
    border-radius: var(--mh-radius-sm);
}

/* Navbar */
.navbar {
    background-color: var(--mh-bg-elev-1) !important;
    border-bottom: 1px solid var(--mh-border);
    box-shadow: none !important;
    padding-top: .75rem;
    padding-bottom: .75rem;
}
.navbar .navbar-brand {
    color: var(--mh-text);
    font-size: 1.125rem;
    display: inline-flex;
    align-items: center;
}
.navbar .navbar-brand i { color: var(--mh-primary); }
.navbar .navbar-brand:hover { color: var(--mh-text); }
.navbar .nav-link { color: var(--mh-text-muted); }
.navbar .nav-link:hover { color: var(--mh-text); }

/* Cards */
.card {
    background-color: var(--mh-bg-elev-1);
    border: 1px solid var(--mh-border);
    border-radius: var(--mh-radius);
    box-shadow: var(--mh-shadow-1);
}
.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--mh-border);
    padding: 1rem 1.25rem;
}
.card-body { padding: 1.25rem; }
.card-title { margin-bottom: 0; font-size: 1.0625rem; }

/* Buttons */
.btn {
    font-family: var(--mh-font-body);
    font-weight: 500;
    border-radius: var(--mh-radius);
    padding: .55rem 1rem;
    transition: background-color .15s ease-out, color .15s ease-out, border-color .15s ease-out, transform .12s ease-out;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    --bs-btn-bg: var(--mh-primary);
    --bs-btn-border-color: var(--mh-primary);
    --bs-btn-hover-bg: var(--mh-primary-hover);
    --bs-btn-hover-border-color: var(--mh-primary-hover);
    --bs-btn-active-bg: var(--mh-primary-hover);
    --bs-btn-active-border-color: var(--mh-primary-hover);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--mh-primary);
    --bs-btn-disabled-border-color: var(--mh-primary);
    --bs-btn-disabled-color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-outline-primary {
    --bs-btn-color: var(--mh-primary);
    --bs-btn-border-color: var(--mh-primary);
    --bs-btn-hover-bg: var(--mh-primary);
    --bs-btn-hover-border-color: var(--mh-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--mh-primary);
    --bs-btn-active-border-color: var(--mh-primary);
    --bs-btn-active-color: #fff;
}
.btn-outline-secondary {
    --bs-btn-color: var(--mh-text);
    --bs-btn-border-color: var(--mh-border-strong);
    --bs-btn-bg: transparent;
    --bs-btn-hover-bg: var(--mh-bg-elev-2);
    --bs-btn-hover-border-color: var(--mh-border-strong);
    --bs-btn-hover-color: var(--mh-text);
    --bs-btn-active-bg: var(--mh-bg-elev-2);
    --bs-btn-active-color: var(--mh-text);
    --bs-btn-active-border-color: var(--mh-border-strong);
}
.btn-outline-danger {
    --bs-btn-color: var(--mh-danger);
    --bs-btn-border-color: var(--mh-danger);
    --bs-btn-bg: transparent;
    --bs-btn-hover-bg: var(--mh-danger);
    --bs-btn-hover-border-color: var(--mh-danger);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--mh-danger);
    --bs-btn-active-color: #fff;
}
.btn-link { color: var(--mh-primary); text-decoration: none; }
.btn-link:hover { color: var(--mh-primary-hover); }

/* Forms */
.form-control, .form-select {
    background-color: var(--mh-bg);
    border: 1px solid var(--mh-border-strong);
    color: var(--mh-text);
    border-radius: var(--mh-radius);
    padding: .55rem .75rem;
    transition: border-color .15s ease-out, box-shadow .15s ease-out, background-color .15s ease-out;
}
.form-control::placeholder, .form-select::placeholder { color: var(--mh-text-subtle); }
.form-control:focus, .form-select:focus {
    background-color: var(--mh-bg);
    border-color: var(--mh-primary);
    color: var(--mh-text);
    box-shadow: 0 0 0 3px var(--mh-primary-soft);
}
.form-label {
    color: var(--mh-text-muted);
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: .375rem;
}
.form-check-input {
    background-color: var(--mh-bg);
    border: 1px solid var(--mh-border-strong);
}
.form-check-input:checked {
    background-color: var(--mh-primary);
    border-color: var(--mh-primary);
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--mh-primary-soft);
    border-color: var(--mh-primary);
}
input[type="file"].form-control { padding: .35rem .5rem; }
input[type="file"].form-control::file-selector-button {
    background-color: var(--mh-bg-elev-2);
    color: var(--mh-text);
    border: 0;
    border-radius: var(--mh-radius-sm);
    padding: .35rem .75rem;
    margin-right: .75rem;
    font-family: var(--mh-font-body);
    transition: background-color .15s ease-out;
}
input[type="file"].form-control::file-selector-button:hover { background-color: var(--mh-bg-elev-1); }

/* Lists */
.list-group {
    --bs-list-group-bg: transparent;
    --bs-list-group-border-color: var(--mh-border);
    --bs-list-group-color: var(--mh-text);
}
.list-group-item {
    background-color: transparent;
    border-color: var(--mh-border);
    color: var(--mh-text);
}

/* Alerts */
.alert {
    border-radius: var(--mh-radius);
    border: 1px solid var(--mh-border);
}
.alert-success {
    background-color: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.32);
    color: #4ade80;
}
.alert-danger {
    background-color: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.32);
    color: #f87171;
}

/* Notifications (top-right toasts) */
.notification {
    background-color: var(--mh-bg-elev-2);
    border: 1px solid var(--mh-border);
    border-left: 3px solid var(--mh-primary);
    color: var(--mh-text);
    border-radius: var(--mh-radius);
    box-shadow: var(--mh-shadow-2);
    padding: .75rem 1rem;
    max-width: 320px;
    margin-bottom: .5rem;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .2s ease-out, transform .2s ease-out;
}
.notification.show { opacity: 1; transform: translateY(0); }
.notification.alert-success { border-left-color: var(--mh-success); }
.notification.alert-danger { border-left-color: var(--mh-danger); }

/* Footer */
footer {
    background-color: transparent !important;
    border-top: 1px solid var(--mh-border);
    color: var(--mh-text-muted);
    padding: 1.25rem 0;
    margin-top: 3rem;
}
footer a, footer .text-muted { color: var(--mh-text-muted) !important; }
footer a:hover { color: var(--mh-text) !important; }

/* Song list + player */
.song-item {
    display: flex;
    align-items: center;
    padding: .75rem;
    gap: .85rem;
    border-color: var(--mh-border) !important;
    border-radius: 0;
    transition: background-color .15s ease-out;
}
/* Round only the outer corners of the list as a whole */
.list-group .song-item:first-child {
    border-top-left-radius: var(--mh-radius);
    border-top-right-radius: var(--mh-radius);
}
.list-group .song-item:last-child {
    border-bottom-left-radius: var(--mh-radius);
    border-bottom-right-radius: var(--mh-radius);
}
.song-item:hover { background-color: var(--mh-bg-elev-2); }
.play-button {
    width: 44px;
    height: 44px;
    border-radius: var(--mh-radius-pill);
    background: linear-gradient(135deg, var(--mh-primary) 0%, #6d28d9 100%);
    color: #fff;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 0;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.32);
    transition: transform .15s ease-out, box-shadow .15s ease-out;
    cursor: pointer;
}
.play-button:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(139, 92, 246, 0.45); color: #fff; }
.play-button i { padding-left: 2px; }
.song-info { flex-grow: 1; min-width: 0; }
.song-info h5 {
    font-family: var(--mh-font-display);
    font-size: .975rem;
    margin-bottom: .15rem;
    color: var(--mh-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-info p {
    font-size: .8rem;
    color: var(--mh-text-subtle);
    margin-bottom: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 575px) {
    .song-item {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        column-gap: .65rem;
        row-gap: .1rem;
        padding: .55rem .65rem;
        align-items: center;
    }
    .song-item .play-button { grid-column: 1; grid-row: 1 / span 2; }
    .song-item .song-info  { grid-column: 2; grid-row: 1; }
    .song-item .song-actions { grid-column: 3; grid-row: 1; font-size: .8rem; gap: .35rem; }
    .song-item .song-date {
        grid-column: 2 / span 2;
        grid-row: 2;
        font-size: .75rem;
        align-self: start;
    }
    .song-info h5 { font-size: .925rem; }
}
.song-date {
    flex-shrink: 0;
    color: var(--mh-text-subtle);
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.song-actions {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--mh-text-muted);
    font-size: .85rem;
}

/* Audio player progress
   Two markup variants:
   - Dashboard (index.php / profile.php): #progressBar = container, #progress = fill
   - Single-track (play_song.php):        .progress-bar-container = container, .progress-bar = fill
   Scope by parent so the ID/class collision doesn't bleed across pages. */
#audioPlayer #progressBar,
.custom-audio-player .progress-bar-container {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--mh-bg-elev-2);
    border-radius: var(--mh-radius-pill);
    cursor: pointer;
    overflow: visible;
    margin: .85rem 0;
    touch-action: manipulation;
}
/* Expand the touch target to ~30px tall without changing the visual.
   Clicks on ::before hit the parent; getBoundingClientRect() math still works. */
#audioPlayer #progressBar::before,
.custom-audio-player .progress-bar-container::before {
    content: '';
    position: absolute;
    inset: -12px 0;
}
#audioPlayer #progress,
.custom-audio-player .progress-bar {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--mh-primary), #ec4899);
    border-radius: var(--mh-radius-pill);
    width: 0;
    transition: width .1s linear;
}
#playerControls, .controls {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-top: .25rem;
    color: var(--mh-text-muted);
}
#playerControls #playPauseBtn, .play-pause-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--mh-primary); border: 0; color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background-color .15s ease-out, transform .12s ease-out;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.28);
    font-size: 1rem;
    padding: 0;
}
#playerControls #playPauseBtn:hover, .play-pause-btn:hover { background: var(--mh-primary-hover); transform: translateY(-1px); }
.time-display, #currentTime, #duration { font-variant-numeric: tabular-nums; color: var(--mh-text-muted); font-size: .9rem; }

/* Sticky bottom player (homepage / dashboard) */
#audioPlayer.sticky-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1040;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-top: 1px solid var(--mh-border);
    background-color: rgba(22, 25, 34, 0.88);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.45);
}
#audioPlayer.sticky-player .card-body {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: .25rem .9rem;
    padding: .65rem 1.25rem;
    padding-bottom: calc(.65rem + env(safe-area-inset-bottom));
    max-width: 1200px;
    margin: 0 auto;
}
#audioPlayer.sticky-player #progressBar {
    grid-column: 1 / -1;
    order: -1;
    margin: 0 0 .25rem 0;
}
#audioPlayer.sticky-player #playerControls { margin-top: 0; }
#audioPlayer.sticky-player .text-muted {
    margin: 0 !important;
    min-width: 0;
    color: var(--mh-text-muted) !important;
    text-align: right;
    overflow: hidden;
}
#audioPlayer.sticky-player #nowPlaying {
    color: var(--mh-text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
body.has-sticky-player {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
@media (max-width: 575px) {
    #audioPlayer.sticky-player .card-body {
        padding-left: .85rem;
        padding-right: .85rem;
        gap: .25rem .65rem;
    }
    body.has-sticky-player {
        padding-bottom: calc(108px + env(safe-area-inset-bottom));
    }
}

/* Custom audio player on play_song.php */
.custom-audio-player {
    background: var(--mh-bg-elev-1) !important;
    border: 1px solid var(--mh-border);
    border-radius: var(--mh-radius);
    padding: 1.25rem !important;
    box-shadow: var(--mh-shadow-1) !important;
}

/* Hero card */
.hero-card {
    border-radius: var(--mh-radius-lg);
    overflow: hidden;
    border: 1px solid var(--mh-border) !important;
    background-color: var(--mh-bg-elev-1) !important;
}
.hero-card .hero-image-wrap {
    background-color: #000;
    position: relative;
    min-height: 280px;
}
.hero-card .hero-image-wrap::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.32) 0%, rgba(13, 15, 20, 0) 60%);
    pointer-events: none;
}
.hero-card ul li i { color: var(--mh-primary); }

/* Star rating dark adapt */
.star-rating label { color: rgba(255, 255, 255, 0.18); }
.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label { color: #fbbf24; }
.star-display { color: #fbbf24; }

/* Feedback list cards */
.feedback-item {
    background: var(--mh-bg-elev-1);
    border: 1px solid var(--mh-border);
    border-radius: var(--mh-radius);
    padding: 1rem !important;
    margin: .5rem 0;
}

/* Layout helper */
main.container { padding-top: 1.5rem; padding-bottom: 1.5rem; }

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