:root {
    --primary: #fb8c00;
    --primary-dark: #ef6c00;
    --primary-hover: #f57c00;
    --bg: #f4f7f6;
    --sidebar: #2c3e50;
    --text: #333;
    --text-dim: #666;
    --white: #ffffff;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --border: #ddd;

    /* Dark Mode Palette for High Readability */
    --dark-bg-main: #181a1b;
    --dark-card-bg: #25282a;
    --dark-text-main: #e8e8e8;
    --dark-text-dim: #b0b0b0;
    --dark-border: #3a3f42;
    --dark-input-bg: #323639;
    --dark-sidebar-bg: #1f2224;
    --dark-link: #60a5fa;
}

/* Remap core variables when dark mode is active */
body.dark-mode {
    --bg: var(--dark-bg-main);
    --card-bg: var(--dark-card-bg);
    --white: var(--dark-card-bg);
    --text: var(--dark-text-main);
    --text-dim: var(--dark-text-dim);
    --border: var(--dark-border);
    --input-bg: var(--dark-input-bg);
    --sidebar: var(--dark-sidebar-bg);
}

/* Accessibility & Visibility overrides for Dark Mode */
body.dark-mode a:not(.btn-primary):not(.btn-secondary):not(.page-link):not(.action-link),
body.dark-mode a:not(.btn-primary):not(.btn-secondary):not(.page-link):not(.action-link):visited { color: #ffffff; }
body.dark-mode .admin-info { background: #3a3a2a; border-color: #6a6a4a; color: #e0e0e0; }
body.dark-mode .admin-info strong { color: #ffeb3b; }
body.dark-mode .log-container { background: #0d1117; border-color: #30363d; color: #c9d1d9; }
body.dark-mode .sidebar { border-right-color: rgba(255,255,255,0.1); }
body.dark-mode .sidebar nav a { color: var(--text-dim); }
body.dark-mode .sidebar nav a:hover, 
body.dark-mode .sidebar nav a.active { color: #fff; background: rgba(255,255,255,0.1); }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar);
    color: white;
    padding: 2rem;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
    position: relative;
    overflow-x: hidden;
    flex-shrink: 0;
}

/* Collapsed Desktop State */
.sidebar.collapsed {
    width: 80px;
    padding: 2rem 1rem;
}

.sidebar.collapsed h2,
.sidebar.collapsed .menu-group-label,
.sidebar.collapsed nav a span:last-child,
.sidebar.collapsed .btn-admin-back span:last-child,
.sidebar.collapsed hr {
    display: none;
}

.sidebar.collapsed nav a {
    text-align: center;
    padding: 12px 0;
    font-size: 1.4rem;
}

.sidebar.collapsed nav a span:first-child {
    display: block;
    width: 100%;
}

.sidebar.collapsed .menu-group-content {
    padding-left: 0;
}

.sidebar-search-wrapper {
    margin-bottom: 1rem;
    padding: 0 15px;
}

.sidebar-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Class to hide elements during search */
.hidden-by-search { display: none !important; }

.sidebar h2 { font-size: 1.5rem; margin-bottom: 2rem; color: var(--primary); }

.sidebar-collapse-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sidebar-collapse-btn:hover {
    background: var(--primary);
}

.sidebar nav a {
    display: block;
    color: #ecf0f1;
    text-decoration: none;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; /* Ensure flex for icon/text separation */
    align-items: center;
    gap: 10px;
    padding: 10px 15px; /* Adjust padding for better look */
    transition: background 0.2s, color 0.2s;
}

.sidebar nav a:hover,
.sidebar nav a:focus-visible {
    color: #ffffff;
    background: rgba(255,255,255,0.1);
}

.sidebar nav a.active {
    color: #ffffff;
    font-weight: 700;
    background: rgba(255,255,255,0.14);
}

/* Adjustments for collapsed state with new structure */
.sidebar.collapsed .sidebar-search-wrapper {
    padding: 0; /* Remove padding when collapsed */
}

.sidebar.collapsed .sidebar-search-input {
    display: none; /* Hide search input when collapsed */
}
.sidebar.collapsed .menu-group-label {
    padding: 10px 0; /* Center label when collapsed */
}

.sidebar nav a.danger-link { color: #ff8a80; }

.menu-group { margin-bottom: 15px; }
.menu-group-label {
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 15px;
    display: block;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    background: transparent;
    border: none;
    font: inherit;
}
.menu-group-label:hover,
.menu-group-label:focus {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}
.menu-group-label:focus-visible {
    outline: 2px solid rgba(243, 156, 18, 0.75);
}
.menu-group-content { display: block; padding-left: 1rem; }
.menu-group.expanded .menu-group-content { display: block; }

.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.admin-page-header h1 {
    margin: 0;
    color: var(--text);
    font-size: 2.1rem;
}

.admin-page-header p {
    margin: 0;
    color: var(--text-dim);
    max-width: 48rem;
}

.admin-info {
    background: #fff9e1;
    border: 1px solid #f4d087;
    border-radius: 12px;
    padding: 1.4rem 1.5rem;
    margin-bottom: 1.5rem;
    color: #2f2f2f;
}

.admin-info strong {
    color: #a66300;
}

.log-container {
    background: #111827;
    color: #e5e7eb;
    padding: 22px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border: 1px solid rgba(255,255,255,0.12);
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: rgba(255,255,255,0.14);
}

.content {
    flex: 1;
    padding: 3rem;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

header { 
    margin-bottom: 2rem; 
    overflow-wrap: break-word;
    word-break: break-word;
}
header h1 { 
    margin: 0; 
    font-size: 2rem; 
    word-break: break-word;
    overflow-wrap: break-word;
}
header p { 
    color: #666; 
    overflow-wrap: break-word;
    word-break: break-word;
}

.admin-form {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
}

.admin-form h2 {
    word-break: break-word;
    overflow-wrap: break-word;
    margin-top: 0;
}

.admin-form p {
    word-break: break-word;
    overflow-wrap: break-word;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.field { 
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}
.field.full-width { 
    grid-column: span 2; 
    width: 100%;
}

label { 
    font-weight: 600; 
    font-size: 0.9rem; 
    color: #555;
    word-break: break-word;
    overflow-wrap: break-word;
}

input, textarea, select {
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: none;
    border: 1px solid var(--border);
    padding: 1rem 2rem;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary,
.btn-secondary,
.btn-link {
    font: inherit;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .admin-container { flex-direction: column; }
    /* Allow admin-helpers styles to control sidebar positioning */
    .sidebar { 
        padding: 1rem; 
    }
    .content { padding: 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .field.full-width { grid-column: span 1; }
    .actions { flex-direction: column; }
    .page-toolbar { flex-direction: column; align-items: stretch; gap: 1rem; }
    .admin-form { padding: 1rem; }
    .content header { margin-bottom: 1.5rem; }
    .content header h1 { font-size: 1.5rem; }
}

.song-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    overflow-x: auto;
    display: block;
    max-width: 100%;
}

.song-table th, .song-table td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 0.95rem;
}

.song-table th {
    background: #f8f9fa;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    max-width: 100%;
    box-sizing: border-box;
}

.manage-songs-table {
    min-width: 100%;
    width: 100%;
    display: table;
}

.manage-songs-table th,
.manage-songs-table td {
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.manage-songs-table th {
    white-space: normal;
    line-height: 1.3;
}

.manage-songs-table td code {
    display: block;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.manage-songs-table th:last-child,
.manage-songs-table td:last-child {
    white-space: normal;
}

.manage-songs-table th:nth-child(1),
.manage-songs-table td:nth-child(1) {
    width: 40px;
}

.manage-songs-table th:nth-child(4),
.manage-songs-table td:nth-child(4) {
    min-width: 100px;
}

.manage-songs-table th:nth-child(8),
.manage-songs-table td:nth-child(8) {
    min-width: 60px;
}

.manage-songs-table th:nth-child(9),
.manage-songs-table td:nth-child(9) {
    min-width: 80px;
}

.badge {
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
}

.action-link {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    margin-right: 10px;
}

.action-link.edit { color: var(--primary); }
.action-link.delete { color: #e74c3c; }

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 1rem;
}

.page-link {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    border-radius: 4px;
    background: var(--white);
    transition: all 0.2s;
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link:hover:not(.active) {
    background: #f8f9fa;
    border-color: var(--primary);
}

.alert {
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    font-weight: 600;
}
.alert.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Quill Editor Height */
.field .editor-container {
    height: 250px;
}

.view-toggle {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    margin-left: 10px;
}

.code-view-textarea {
    width: 100%;
    height: 250px;
    display: none;
    font-family: 'Courier New', monospace;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    box-sizing: border-box;
    resize: vertical;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    align-items: center; 
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    text-align: left;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .admin-container { 
        flex-direction: column;
        display: flex;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .sidebar { 
        width: 100%;
        max-width: 100vw;
        padding: 1rem;
        position: relative;
        overflow-x: hidden;
    }
    
    .content { 
        padding: 1rem;
        padding-top: 1.5rem;
        max-width: 100%;
        width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    .content header {
        margin-bottom: 1.5rem;
        margin-top: 1rem;
        overflow-x: hidden;
    }
    
    .content header h1 { 
        font-size: 1.3rem;
        margin: 0;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    .content header p {
        font-size: 0.9rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    .form-grid { 
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .field.full-width { 
        grid-column: span 1;
    }
    
    .actions { 
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .actions button {
        width: 100%;
    }
    
    .page-toolbar { 
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .admin-form { 
        padding: 1rem;
        margin-bottom: 1.5rem;
        border-radius: 6px;
    }
    
    .admin-form h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .admin-form input,
    .admin-form textarea,
    .admin-form select {
        width: 100%;
        margin-bottom: 0.75rem;
        font-size: 16px;
        min-height: 44px;
        box-sizing: border-box;
        padding: 10px;
    }
    
    .admin-form form {
        flex-direction: column !important;
        gap: 10px !important;
        display: flex !important;
    }
    
    .admin-form form .field {
        flex: none !important;
        width: 100% !important;
        margin-bottom: 0 !important;
    }
    
    /* Stats Grid Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    .stat-card {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .stat-card h2 {
        font-size: 1.8rem;
    }
    
    .stat-card p {
        font-size: 0.8rem;
    }
    
    /* Table Responsive */
    .song-table,
    .table-scroll {
        overflow-x: auto;
        display: block;
        width: 100%;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
    }
    
    .song-table thead {
        display: none;
    }
    
    .song-table tbody,
    .song-table tr,
    .song-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    
    .song-table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border);
        border-radius: 6px;
        padding: 1rem;
        background: var(--white);
    }
    
    .song-table td {
        padding: 0.5rem 0;
        text-align: left;
        border: none;
        padding-left: 0;
    }
    
    .song-table td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-dim);
        display: block;
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }
    
    .manage-songs-table tbody,
    .manage-songs-table tr {
        display: block;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .manage-songs-table tr {
        border: 1px solid var(--border);
        border-radius: 6px;
        padding: 1rem;
        background: var(--white);
    }
    
    .manage-songs-table td,
    .manage-songs-table th {
        display: block;
        width: 100%;
        padding: 0.5rem 0;
        text-align: left;
        border: none;
        min-width: auto !important;
        word-break: break-word;
    }
    
    .manage-songs-table thead {
        display: none;
    }
    
    /* Button Sizing Mobile */
    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1.5rem;
        width: auto;
        min-height: 44px;
        font-size: 1rem;
    }
    
    .btn-primary:active {
        transform: scale(0.98);
    }
    
    /* Alert Mobile */
    .alert {
        padding: 1rem;
        margin-bottom: 1rem;
        font-size: 0.9rem;
        border-radius: 6px;
        word-break: break-word;
    }
    
    /* Modal Mobile */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
}

    /* Better button layout on mobile */
    .actions {
        gap: 8px;
    }

    .actions .btn-primary,
    .actions .btn-secondary,
    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        min-height: 44px;
        box-sizing: border-box;
    }

    /* Mobile table improvements */
    .song-table {
        font-size: 13px;
        overflow-x: auto;
        display: block;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 80px; /* Space for bulk action bar */
    }

    .song-table th,
    .song-table td {
        padding: 8px 6px;
        min-width: 70px;
    }

    /* Adjusted Sticky Columns for Checkbox, ID and Name */
    .song-table th:first-child,
    .song-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 12;
        background-color: #f8f9fa;
        width: 42px !important;
        min-width: 42px !important;
        text-align: center;
        padding: 8px 4px;
    }
    .song-table td:first-child { background-color: #fff; }

    .song-table th:nth-child(2),
    .song-table td:nth-child(2) {
        position: sticky;
        left: 42px;
        z-index: 11;
        background-color: #f8f9fa;
        width: 120px !important;
        min-width: 120px !important;
    }
    .song-table td:nth-child(2) { background-color: #fff; }

    .song-table th:nth-child(3),
    .song-table td:nth-child(3) {
        position: sticky;
        left: 162px; 
        z-index: 10;
        background-color: #f8f9fa;
        box-shadow: none;
        min-width: 100px;
    }
    .song-table td:nth-child(3) { background-color: #fff; }

    .row-checkbox { 
        width: 18px; 
        height: 18px; 
        cursor: pointer; 
        vertical-align: middle;
        min-width: 18px;
    }

    /* Mobile filter form improvements */
    .admin-form form {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .admin-form form .field {
        flex: none !important;
        width: 100% !important;
    }

    /* Mobile pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }

    .page-link {
        padding: 8px 12px;
        font-size: 14px;
        min-width: 44px;
        text-align: center;
    }

    /* Transform text links into colorful icons to save horizontal space */
    .action-link,
    .song-table td:last-child button.action-link:not(.toast-close) {
        font-size: 0 !important; /* Hide original text */
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: 10px;
        margin-right: 6px;
        transition: transform 0.15s ease;
        vertical-align: middle;
        padding: 0 !important;
        line-height: 1 !important;
        border: 1px solid transparent;
    }
    .action-link:active,
    .song-table td:last-child button.action-link:active { transform: scale(0.9); }

    .action-link.edit,
    .song-table td:last-child button.action-link.btn-info {
        background: rgba(243, 156, 18, 0.15) !important;
        border: 1px solid rgba(243, 156, 18, 0.3);
        color: transparent !important;
    }
    .song-table td:last-child button.action-link.btn-info::before { content: '✏️'; font-size: 1.1rem; }
    .action-link.edit::before { content: '✏️'; font-size: 1.1rem; }
    .action-link.edit i,
    .song-table td:last-child button.btn-info i {
        font-size: 1.1rem !important;
        line-height: 1 !important;
        display: inline-block !important;
        color: #f39c12 !important;
    }

    .action-link.delete,
    .song-table td:last-child button.action-link.btn-danger {
        background: rgba(231, 76, 60, 0.15) !important;
        border: 1px solid rgba(231, 76, 60, 0.3);
        color: transparent !important;
    }
    .song-table td:last-child button.action-link.btn-danger::before { content: '🗑️'; font-size: 1.1rem; }
    .action-link.delete::before { content: '🗑️'; font-size: 1.1rem; }
    .action-link.delete i,
    .song-table td:last-child button.action-link.btn-danger i {
        font-size: 1.1rem !important;
        line-height: 1 !important;
        display: inline-block !important;
        color: #e74c3c !important;
    }
    
    @media (max-width: 600px) {
        .action-link,
        .song-table td:last-child button.action-link:not(.toast-close) {
            width: 36px;
            height: 36px;
            margin-right: 4px;
            font-size: 0 !important;
        }
    }
    
    @media (max-width: 480px) {
        .action-link,
        .song-table td:last-child button.action-link:not(.toast-close) {
            width: 34px;
            height: 34px;
            margin-right: 3px;
        }
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding: 0.75rem;
    }

    .content {
        padding: 0.75rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .admin-form {
        padding: 0.75rem;
        margin-bottom: 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .content header h1 {
        font-size: 1.25rem;
        word-break: break-word;
    }

    .content header p {
        font-size: 0.85rem;
        word-break: break-word;
    }

    /* Stats grid mobile layout */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    .stat-card {
        padding: 12px;
        border-radius: 8px;
    }

    .stat-card h2 {
        font-size: 1.5rem;
        margin: 8px 0;
    }

    .stat-card p {
        font-size: 0.75rem;
        margin: 0;
    }

    /* Form inputs extra small */
    .admin-form input,
    .admin-form textarea,
    .admin-form select {
        padding: 8px;
        font-size: 16px;
        min-height: 40px;
        margin-bottom: 0.5rem;
    }

    .admin-form label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .actions button {
        padding: 10px 12px;
        font-size: 0.9rem;
        min-height: 40px;
    }

    /* Alert extra small */
    .alert {
        padding: 0.75rem;
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    /* Modal improvements for mobile */
    .modal-content {
        width: 95%;
        padding: 1rem;
        max-height: 90vh;
        border-radius: 8px;
    }

    .modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Table extra small */
    .song-table {
        font-size: 0.8rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .song-table th {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .song-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .song-table tr {
        margin-bottom: 0.75rem;
        padding: 0.75rem;
    }

    /* Buttons smaller on ultra-small phones */
    .btn-primary,
    .btn-secondary {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-height: 40px;
    }

    /* Admin form heading smaller */
    .admin-form h2 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
        word-break: break-word;
    }

    /* Page toolbar extra small */
    .page-toolbar {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    /* Text wrapping for all content */
    label,
    .admin-form p,
    .admin-info {
        word-break: break-word;
        overflow-wrap: break-word;
    }
}
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 1.25rem;
        border-radius: 12px;
    }

    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }

    .modal-actions button {
        width: 100%;
        padding: 12px;
    }

    /* Pagination mobile layout */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .page-link {
        padding: 8px 12px;
        font-size: 14px;
    }

    /* Better form field spacing on mobile */
    .field {
        margin-bottom: 1rem;
    }

    .field label {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
        display: block;
    }

    /* Alert message improvements */
    .alert {
        font-size: 0.9rem;
        padding: 12px;
        word-wrap: break-word;
    }
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.muted-text {
    color: #666;
}

.card-list {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.card-row {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
}

.card-row:last-child {
    border-bottom: none;
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: #777;
}

/* Global Admin Layout Improvements: Full-width on desktop, responsive on mobile */
@media (min-width: 1025px) {
    .admin-container {
        display: flex !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100vh;
    }
    .content {
        flex: 1 !important;
        padding: 40px !important;
        max-width: none !important;
    }
    /* Ensure tables utilize full width on desktop */
    .table-scroll {
        overflow-x: visible !important;
    }
    .song-table {
        width: 100% !important;
        table-layout: auto !important;
    }
}

@media (max-width: 1024px) {
    .content {
        padding: 20px !important;
    }
    /* Re-enable horizontal scroll for tables on smaller screens */
    .table-scroll {
        overflow-x: auto !important;
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 20px;
    }
    .song-table {
        min-width: 800px; /* Ensure table is still readable when scrolled */
    }
}

/* Unified auth page theme and accessibility improvements */
.header {
    color: #ffffff;
}
#header-title {
    color: #ffffff;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
body.light-mode .header,
body.light-mode #header-title {
    color: var(--text-main);
    text-shadow: none;
}
.login-btn,
.theme-btn,
.lang-btn,
.user-btn,
.print-btn,
.more-btn {
    border-radius: 12px;
}

.auth-page-wrapper,
.register-page-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: transparent;
    color: var(--text-main);
}

.login-box,
.auth-container,
.reset-box {
    width: 100%;
    max-width: 520px !important;
    padding: 32px !important;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16);
    box-sizing: border-box;
}

.login-header,
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header h1,
.auth-header h1,
.reset-box h1 {
    color: var(--primary);
    margin: 0 0 10px;
    font-size: clamp(1.9rem, 2.4vw, 2.4rem);
    line-height: 1.1;
}

.login-header p,
.auth-header p,
.reset-box p,
.footer-text,
.timer,
.field label {
    color: var(--text-dim);
}

.field,
.form-group {
    margin-bottom: 20px;
}

.field label,
.form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

input,
textarea,
select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--input-bg);
    color: var(--text-main);
    font-size: 1rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

input::placeholder,
textarea::placeholder {
    color: rgba(255, 255, 255, 0.72);
}

body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
    color: #6b7280;
}

.btn-primary,
.btn-submit {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover,
.btn-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.btn-primary:disabled,
.btn-submit:disabled {
    background: rgba(255, 255, 255, 0.35);
    cursor: not-allowed;
    opacity: 0.75;
}

.footer-links,
.footer-text,
.back-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-dim);
    font-size: 0.95rem;
}

.footer-links a,
.footer-text a,
.back-link a,
.footer-text button {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.footer-links a:hover,
.footer-text a:hover,
.back-link a:hover,
.footer-text button:hover {
    text-decoration: underline;
}

.steps {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 28px;
    position: relative;
    padding: 0 4px;
}

.steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 24px;
    right: 24px;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-50%);
    z-index: 0;
}

.step {
    position: relative;
    z-index: 1;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-dim);
    font-weight: 800;
}

.step.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.step.active::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.12);
}

.alert.error,
.alert.error {
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid rgba(231, 76, 60, 0.25);
    color: #fde2dc;
}

.alert.success,
.alert.success {
    background: rgba(249, 168, 37, 0.12);
    border: 1px solid rgba(249, 168, 37, 0.3);
    color: #fff8e7;
}

.alert {
    border-radius: 14px;
    padding: 16px 18px;
}

@media (max-width: 680px) {
    .login-box,
    .auth-container,
    .reset-box {
        padding: 24px !important;
    }
    .steps {
        display: none;
    }
    .auth-page-wrapper,
    .register-page-wrapper {
        padding: 16px;
    }
    .btn-primary,
    .btn-submit {
        font-size: 0.98rem;
    }
}

/* Auth Pages Header Navigation Button */
.auth-header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--button-secondary-bg, rgba(255, 255, 255, 0.08));
    color: var(--text-main, #e8e8e8);
    border: 1px solid var(--button-secondary-border, rgba(255, 255, 255, 0.14));
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
}

.auth-header-btn:hover {
    background: var(--button-secondary-hover-bg, rgba(255, 255, 255, 0.14));
    color: var(--primary, #f59e0b);
    border-color: var(--primary, #f59e0b);
}

body.light-mode .auth-header-btn {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
    color: #202124;
}

body.light-mode .auth-header-btn:hover {
    background: rgba(251, 140, 0, 0.12);
    color: #b45309;
    border-color: rgba(180, 83, 9, 0.2);
}
