.gap-x-1 { column-gap: 0.25rem !important; }
.gap-x-2 { column-gap: 0.5rem !important; }
.gap-x-3 { column-gap: 1rem !important; }
.gap-x-4 { column-gap: 1.5rem !important; }
.gap-x-5 { column-gap: 3rem !important; }
.gap-y-1 { row-gap: 0.25rem !important; }
.gap-y-2 { row-gap: 0.5rem !important; }
.gap-y-3 { row-gap: 1rem !important; }
.gap-y-4 { row-gap: 1.5rem !important; }
.gap-y-5 { row-gap: 3rem !important; }

/* Theme Variables */
:root {
    text-decoration-skip-ink: all;
}

/* Global Reset for Icon Links */
.btn-link, .btn-xs, .edit-btn, .ai-btn, .refresh-btn, .stanza-wrapper .btn-link {
    text-decoration: none !important;
    box-shadow: none !important;
}

.ai-btn, .ai-btn:focus, .ai-btn:active {
    color: rgb(200, 183, 1);
}

/* Unified Search Focus */
.input-group {
    transition: box-shadow 0.2s ease-in-out, border-color 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.input-group:focus-within {
    border-radius: 0.5rem;
    box-shadow: 0 10px 40px rgba(74, 137, 220, 0.2), 0 0 0 0.5rem rgba(74, 137, 220, 0.1) !important;
    transform: scale(1.015);
}
.input-group:focus-within .input-group-text,
.input-group:focus-within .form-control {
    border-color: #4a89dc !important;
}
.input-group .form-control:focus {
    box-shadow: none !important;
}

/* Search Bar on Home */
.hero-section .input-group-lg > .form-control,
.hero-section .input-group-lg > .input-group-text {
    padding: 0.8rem 1.2rem;
    font-size: 1.2rem;
}
.hero-section .input-group-lg > .input-group-text {
    padding-right: 0.5rem;
}

/* Password Toggle Styling - Mobile Friendly */
.password-wrapper {
    position: relative;
}
.password-wrapper input.form-control {
    padding-right: 40px; /* Space for the eye icon */
}
.password-toggle-icon {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px;
    z-index: 5;
    color: #6c757d;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.password-toggle-icon:hover, .password-toggle-icon:active {
    color: #4a89dc;
}

:root {
    --bg-body: #f0f0f0; 
    --bg-page: #e6e6e6; 
    --light-bg: #f8f8f8; 
    --light-text: #000000; 
    --dark-text: #333333; 
    --darker-text: #000000; 
    --dark-bg: #d9d9d9; 
    --button-primary: #bfbfbf; 
    --button-primary-hover: #a6a6a6; 
    --const-light: #dcdcdc; 
    --const-lighter: #f8f8f8; 
    --const-dark: #5f5f5f; 
    --const-darker: #313131; 
}

[data-theme="dark"] {
    --bg-body: #121212; 
    --bg-page: #1e1e1e; 
    --light-bg: #2d2d2d; 
    --light-text: #ffffff; 
    --dark-text: #cccccc; 
    --darker-text: #ffffff; 
    --dark-bg: #333333; 
    --button-primary: #444444; 
    --button-primary-hover: #555555; 
}

/* General Styling */
body {
    background-color: var(--bg-body);
    color: var(--light-text);
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    padding-top: 75px; /* Added for fixed header */
    transition: background-color 0.3s, color 0.3s;
}

h1 { margin: 0.5rem 0; font-size: 1.5rem; }
p { margin: 0.5rem 0; }

/* Header & Navbar Improvements */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1030;
    transition: transform 0.3s ease-in-out;
}

.header.nav-hidden {
    transform: translateY(-100%);
}

.navbar {
    background-color: var(--const-lighter);
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    min-height: 56px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.navbar-brand img {
    height: 55px; /* Larger logo to fit the bar height */
    width: auto;
}

.header .user-info a {
    text-decoration: none;
    display: flex;
    align-items: center;
}
.header .user-info img.profile-image {
    width: 32px; /* Slightly smaller */
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid var(--const-light);
}

/* Compact Lyrics & Song View */
.lyrics-section.compact .stanza-header {
    font-size: 0.6rem;
    color: var(--const-dark);
    margin-bottom: 0.1rem;
    opacity: 0.5;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.lyrics-section.compact .stanza-lyrics {
    font-size: 1.25rem !important;
    line-height: 1.6 !important;
    margin-bottom: 1rem !important;
}

.song-meta-badge {
    font-size: 0.6rem !important;
    padding: 2px 6px !important;
}

/* Fixed container behavior */
.container-custom {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    max-width: 1300px;
}

/* Hero Section */
.hero-section {
    background: var(--bg-page);
    padding: 1.5rem 1rem; /* Reduced from 3rem */
    border-radius: 10px;
    margin-bottom: 1rem; /* Reduced from 2rem */
    text-align: center;
    width: 100%;
    color: var(--dark-text);
}

/* Tables (Universal Support) */
.table {
    color: var(--light-text) !important;
    margin-bottom: 1rem; /* Reduced from 2rem */
}
/* ... */
/* Card & Component Overrides for Dark Mode */
.card {
    border-radius: 1rem;
    overflow: hidden;
}

[data-theme="dark"] .card, 
[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-page);
    color: var(--light-text);
    border: 1px solid var(--const-dark);
}
[data-theme="dark"] .list-group-item {
    background-color: var(--bg-page);
    color: var(--light-text);
    border-color: var(--const-dark);
}

/* Card Body Spacing */
.card-body {
    flex: 1 1 auto;
    padding: 1rem 1.25rem; /* Reduced from 2rem */
}

/* Force Light Theme Components (High Priority) */
.force-light, 
[data-theme="dark"] .force-light,
[data-theme="dark"] .dropdown-menu.force-light,
[data-theme="dark"] .navbar.force-light,
[data-theme="dark"] .footer.force-light {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #dee2e6 !important;
}

.force-light h1, .force-light h2, .force-light h3, .force-light h4, .force-light h5, .force-light p, .force-light li, .force-light a, .force-light label,
[data-theme="dark"] .force-light h5, [data-theme="dark"] .force-light p, [data-theme="dark"] .force-light li, [data-theme="dark"] .force-light a, [data-theme="dark"] .force-light label {
    color: #000000 !important;
}

.force-light .text-muted, [data-theme="dark"] .force-light .text-muted {
    color: #6c757d !important;
}

/* Specific Dropdown Item Fixes */
.force-light .dropdown-item, [data-theme="dark"] .force-light .dropdown-item {
    color: #000000 !important;
    background: transparent !important;
}
.force-light .dropdown-item:hover, [data-theme="dark"] .force-light .dropdown-item:hover {
    background-color: #f8f9fa !important;
}

/* Header Fixes */
.navbar.force-light .nav-link, .navbar.force-light .navbar-brand,
[data-theme="dark"] .navbar.force-light .nav-link, [data-theme="dark"] .navbar.force-light .navbar-brand {
    color: #000000 !important;
}

/* Admin Table Inputs */
.table td input {
    margin: -4px -7px;
    padding: 5px 4px;
    width : calc(100% + 14px);
    font-size: 0.95rem;
    background-color: inherit;
    color: inherit;
    border: 1px solid transparent;
}
.table td input:focus {
    background-color: #fff;
    color: #000;
}
[data-theme="dark"] .table td input:focus {
    background-color: #333;
    color: #fff;
}

/* Navbar Dropdown Hover Styling */
@media (min-width: 992px) {
    .header .theme-toggle-icon {
        font-size: 1.2rem;
    }
}
/* Custom Audio Player */
.custom-audio-player {
    display: flex;
    align-items: center;
    background: #f1f3f4;
    border-radius: 24px;
    padding: 4px 12px;
    gap: 10px;
    user-select: none;
}

.audio-player-wrapper.compact {
    padding: 0;
    border-radius: 16px;
    background: transparent;
    border: none;
    width: 100%;
}

.audio-player-wrapper.compact .custom-audio-player {
    padding: 2px 6px;
    gap: 4px;
    background: rgba(0,0,0,0.1);
    border-radius: 16px;
    width: 100%;
}

[data-theme="dark"] .audio-player-wrapper.compact .custom-audio-player {
    background: rgba(255,255,255,0.12);
}

.audio-player-wrapper.compact .play-pause-btn {
    font-size: 0.75rem;
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-player-wrapper.compact .time-display {
    font-size: 0.6rem;
    min-width: 25px;
}

.audio-player-wrapper.compact .progress-container {
    height: 3px;
}

.audio-player-wrapper.compact .audio-label-container {
    font-size: 0.6rem;
    margin-top: 1px;
    padding: 0 4px;
}

[data-theme="dark"] .audio-player-wrapper {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.audio-label-container {
    overflow: hidden;
    white-space: nowrap;
    margin-top: 2px;
    padding: 0 12px;
    font-size: 0.7rem;
    color: #666;
    font-weight: 600;
    display: flex;
    justify-content: center;
}

[data-theme="dark"] .audio-label-container {
    color: #aaa;
}

.audio-label-scroller {
    display: inline-block;
    padding-left: 0;
    transition: transform 0.1s;
}

.audio-label-container.is-overflowing {
    justify-content: flex-start;
}

.audio-label-container.is-overflowing .audio-label-scroller {
    padding-left: 100%;
    animation: marquee 15s linear infinite;
}

@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

[data-theme="dark"] .custom-audio-player {
    background: #3c4043;
}

.custom-audio-player .play-pause-btn {
    background: #4a89dc;
    color: white;
    border: none;
    width: 30px; /* Reduced from 36px */
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s, background 0.2s;
}

.custom-audio-player .play-pause-btn:hover {
    transform: scale(1.05);
    background: #3b78c8;
}

.custom-audio-player .progress-container {
    flex-grow: 1;
    height: 4px; /* Thinner progress bar */
    background: #ccc;
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

[data-theme="dark"] .custom-audio-player .progress-container {
    background: #555;
}

.custom-audio-player .progress-bar-fill {
    height: 100%;
    background: #4a89dc;
    border-radius: 2px;
    width: 0%;
}

.custom-audio-player .time-display {
    font-size: 0.7rem; /* Smaller font */
    font-family: monospace;
    color: #666;
    min-width: 30px;
}

[data-theme="dark"] .custom-audio-player .time-display {
    color: #aaa;
}

.custom-audio-player .volume-icon {
    font-size: 0.9rem;
    cursor: pointer;
}

/* Fix für Listen-Elemente in hellen Karten */
.force-light .list-group-item {
    background-color: #ffffff !important;
    color: #000000 !important;
    padding: 0.5rem 1rem; /* Compact padding */
}

/* Song Card Preview Styling */
.preview-wrapper {
    position: relative;
    background: #fff;
    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;
    overflow: hidden;
}

.preview-img {
    filter: saturate(1.1);
    transition: transform 0.5s ease;
}

.card:hover .preview-img {
    transform: scale(1.05);
}

.preview-gradient-top {
    /* Set via JS, but provide a white base */
    background: linear-gradient(to bottom, #fff, transparent);
}

/* Fullscreen Media Viewer */

#fs-overlay {

    position: fixed;

    top: 0;

    left: 0;

    width: 100vw;

    height: 100vh; /* Fallback */

    height: 100dvh;

    background: #000;

    z-index: 99999; /* Very high */

    display: flex;

    flex-direction: row;

    overflow: hidden;

}



#fs-main {

    flex: 1; /* Takes remaining space */

    height: 100%;

    position: relative;

    overflow-y: auto; 

    overflow-x: hidden;

    display: flex;

    flex-direction: column;

    align-items: center;

    padding: 20px;

    -webkit-overflow-scrolling: touch;

}



#fs-sidebar {

    width: 20%;

    min-width: 120px;

    max-width: 200px;

    height: 100%;

    background: #1a1a1a;

    border-left: 1px solid #333;

    overflow-y: auto;

    flex-shrink: 0;

    z-index: 100000;

    padding: 10px;

    display: flex;

    flex-direction: column;

    gap: 10px;

}



#fs-controls {

    position: fixed;

    top: 10px;

    left: 10px;

    z-index: 100001; /* Above everything */

    display: flex;

    gap: 10px;

    background: rgba(0, 0, 0, 0.5);

    padding: 8px;

    border-radius: 8px;

    backdrop-filter: blur(4px);

}



.fs-thumb {

    width: 100%;

    background: #000;

    border: 2px solid #444;

    cursor: pointer;

    border-radius: 4px;

    opacity: 0.8;

    transition: all 0.2s;

    overflow: hidden;

}



.fs-thumb:hover {

    opacity: 1;

    border-color: #666;

}



.fs-thumb.active {

    border-color: #4a89dc;

    opacity: 1;

    box-shadow: 0 0 8px rgba(74, 137, 220, 0.5);

}



.fs-thumb img {

    width: 100%;

    height: auto;

    display: block;

}



.fs-thumb-text {

    color: #eee;

    font-size: 0.7rem;

    text-align: center;

    padding: 4px;

    background: #222;

}



/* Inverted Mode */

.inverted-mode #fs-main {

    filter: invert(1) hue-rotate(180deg);

    background: #fff;

}

/* Controls and Sidebar stay dark/standard in inverted mode for usability */

/* Disable focus outline for heart buttons */
.btn.bg-transparent:focus, 
.btn.bg-transparent:active,
.btn.bg-transparent:focus-visible,
.btn.bg-transparent.active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* Fix UIcons vertical alignment */
.fi {
    display: inline-block;
    vertical-align: -0.125em; /* Shift down relative to font size */
    line-height: 1;
}

/* Ensure navbar icons are centered in their flex container */
.navbar .fi {
    display: inline-flex;
    align-items: center;
}

/* Sticky Sidebar for Song View */
@media (min-width: 768px) {
    .sticky-sidebar {
        position: sticky;
        top: 80px; /* Offset for fixed header */
        max-height: calc(100vh - 90px);
        overflow-y: auto;
        overflow-x: hidden;
        /* Scrollbar styling for webkit */
        scrollbar-width: thin;
        padding-right: 5px; /* Prevent scrollbar from overlapping content */
    }
    .sticky-sidebar::-webkit-scrollbar {
        width: 6px;
    }
    .sticky-sidebar::-webkit-scrollbar-thumb {
        background-color: rgba(0,0,0,0.2);
        border-radius: 3px;
    }
}

/* Prevent sticky header from obscuring scroll targets */
#song-navigation-bar {
    scroll-margin-top: 100px;
}

/* Liquid Split Layout for Song View */
@media (min-width: 992px) {
    .song-view-page {
        padding-top: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }

    .song-view-page .header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 56px;
        z-index: 1050;
    }

    .song-view-page .container-custom {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    .song-view-page footer {
        margin-top: 0 !important;
        border-top: 1px solid var(--const-light);
    }

    .song-split-container {
        display: grid;
        grid-template-columns: minmax(0, 1500px) 450px;
        grid-template-areas: 
            "main sidebar"
            "suggestions sidebar";
        justify-content: end;
        align-items: start;
        margin-top: 56px;
        min-height: calc(100vh - 56px);
    }

    .song-main-column {
        grid-area: main;
        max-width: 1500px; 
        min-width: 0; 
        padding: 2rem 3rem 0.5rem 3rem;
        background-color: var(--bg-body);
    }

    .song-sidebar-column {
        grid-area: sidebar;
        width: 450px;
        flex-shrink: 0;
        position: sticky;
        top: 56px; /* Below fixed header */
        max-height: calc(100vh - 56px);
        overflow-y: auto;
        background-color: var(--bg-page);
        border-left: 1px solid var(--const-light);
        padding: 1.5rem;
        scrollbar-width: thin;
        box-shadow: -5px 0 15px rgba(0,0,0,0.03);
        height: 100%;
    }

    .suggestions-wrapper {
        grid-area: suggestions;
        background-color: var(--bg-body);
        padding: 0.5rem 3rem 3rem 3rem;
    }

    /* AI Button Color */
    .ai-btn, .ai-btn i {
        color: #ffc107 !important; /* Bootstrap warning/gold */
    }
    .ai-btn:hover {
        background-color: #fff3cd !important;
    }
    
    /* Scrollbar styling for sidebar */
    .song-sidebar-column::-webkit-scrollbar {
        width: 4px;
    }
    .song-sidebar-column::-webkit-scrollbar-thumb {
        background-color: rgba(0,0,0,0.1);
        border-radius: 2px;
    }
}

@media (max-width: 991px) {
    .song-view-page {
        overflow: auto !important;
    }
    .song-view-page .container-custom {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-top: 0 !important;
    }
    .song-split-container {
        flex-direction: column;
        margin-top: 56px;
    }
    .song-main-column {
        order: 1;
        padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    }
    .song-sidebar-column {
        order: 2;
        border-left: none;
        border-top: 1px solid var(--const-light);
        background-color: var(--bg-page);
        padding: 1.5rem;
        width: 100%;
    }
    .suggestions-wrapper {
        order: 3;
        padding: 0.5rem 1.5rem 1.5rem 1.5rem;
        border-top: 1px solid var(--const-light);
    }
}

/* Compact Dropdown Menu */
.dropdown-menu-sm .dropdown-item {
    padding: 0.25rem 1rem;
    font-size: 0.9rem;
}