/* CSS Variables - Minimal & Clean Theme */
:root {
    /* Typography: Hybrid System - Sans-serif for text, Monospace for numbers */
    --font-body: 'Inter', 'system-ui', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', 'Monaco', monospace;

    /* Background Layers - Clean dark theme */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-elevated: #2d333b;
    --bg-accent: #373e47;
    --bg-session: #1a1f26;
    --bg-archive: #1c1f23;
    --bg-modal-overlay: rgba(0, 0, 0, 0.85);

    /* Text Hierarchy */
    --text-primary: #f0f6fc;
    --text-secondary: #e6edf3;
    --text-tertiary: #8b949e;
    --text-muted: #7d8590;
    --text-meta: #656d76;
    --text-inverse: #0d1117;

    --border-primary: #30363d;
    --border-secondary: #484f58;

    /* Category Colors - Minimal palette with 4 distinct categories */
    --color-technical: #4A90E2;        /* Professional Blue */
    --color-technical-light: #6BA5EC;
    --color-technical-surface: rgba(74, 144, 226, 0.12);

    --color-theory: #9B59B6;           /* Deep Purple */
    --color-theory-light: #B07CC6;
    --color-theory-surface: rgba(155, 89, 182, 0.12);

    --color-creative: #E67E22;         /* Warm Orange */
    --color-creative-light: #EC9A4C;
    --color-creative-surface: rgba(230, 126, 34, 0.12);

    --color-repertoire: #27AE60;       /* Fresh Green */
    --color-repertoire-light: #3FC380;
    --color-repertoire-surface: rgba(39, 174, 96, 0.12);

    /* Semantic Colors */
    --accent-primary: #27AE60;
    --accent-primary-light: #3FC380;
    --accent-primary-dark: #1E8449;
    --accent-surface: rgba(39, 174, 96, 0.12);
    --accent-surface-hover: rgba(39, 174, 96, 0.18);

    --accent-success: var(--accent-primary);
    --accent-warning: #d29922;
    --accent-warning-hover: #bb8009;
    --accent-danger: #f85149;
    --accent-danger-hover: #da3633;
    --accent-yellow: #e3b341;
    --accent-red: var(--accent-danger);
    --accent-red-hover: var(--accent-danger-hover);
    --accent-archive: var(--accent-warning);
    --accent-archive-hover: var(--accent-warning-hover);

    /* Shadow System */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 3px 6px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 6px 12px rgba(0, 0, 0, 0.18), 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.22), 0 8px 16px rgba(0, 0, 0, 0.15);
    --shadow-2xl: 0 20px 40px rgba(0, 0, 0, 0.25), 0 12px 24px rgba(0, 0, 0, 0.18);
    --shadow-hover: 0 8px 25px rgba(39, 174, 96, 0.15), 0 4px 10px rgba(0, 0, 0, 0.1);
    --shadow-focus: 0 0 0 3px rgba(39, 174, 96, 0.2);
    --shadow-pressed: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] {
    /* Light Theme - Clean & minimal */
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #f1f3f4;
    --bg-elevated: #ffffff;
    --bg-accent: #eaeef2;
    --bg-session: #f0f8f4;
    --bg-archive: #f0f3f6;
    --bg-modal-overlay: rgba(1, 4, 9, 0.6);

    /* Text Hierarchy */
    --text-primary: #0d1117;
    --text-secondary: #24292f;
    --text-tertiary: #57606a;
    --text-muted: #656d76;
    --text-meta: #8b949e;
    --text-inverse: #ffffff;

    --border-primary: #d0d7de;
    --border-secondary: #8c959f;

    /* Category Colors - Light theme */
    --color-technical: #2E6FB6;
    --color-technical-light: #4A90E2;
    --color-technical-surface: rgba(46, 111, 182, 0.08);

    --color-theory: #7D3C98;
    --color-theory-light: #9B59B6;
    --color-theory-surface: rgba(125, 60, 152, 0.08);

    --color-creative: #C56920;
    --color-creative-light: #E67E22;
    --color-creative-surface: rgba(197, 105, 32, 0.08);

    --color-repertoire: #1E8449;
    --color-repertoire-light: #27AE60;
    --color-repertoire-surface: rgba(30, 132, 73, 0.08);

    /* Semantic Colors */
    --accent-primary: #1E8449;
    --accent-primary-light: #27AE60;
    --accent-primary-dark: #145A32;
    --accent-surface: rgba(30, 132, 73, 0.08);
    --accent-surface-hover: rgba(30, 132, 73, 0.12);

    --accent-success: var(--accent-primary);
    --accent-warning: #9a6700;
    --accent-warning-hover: #7d5300;
    --accent-danger: #cf222e;
    --accent-danger-hover: #a40e26;
    --accent-yellow: #bf8700;
    --accent-red: var(--accent-danger);
    --accent-red-hover: var(--accent-danger-hover);
    --accent-archive: var(--accent-warning);
    --accent-archive-hover: var(--accent-warning-hover);

    /* Shadow System */
    --shadow-sm: 0 1px 3px rgba(1, 4, 9, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 3px 6px rgba(1, 4, 9, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 6px 12px rgba(1, 4, 9, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 12px 24px rgba(1, 4, 9, 0.14), 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 20px 40px rgba(1, 4, 9, 0.16), 0 12px 24px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 8px 25px rgba(30, 132, 73, 0.1), 0 4px 10px rgba(0, 0, 0, 0.06);
    --shadow-focus: 0 0 0 3px rgba(30, 132, 73, 0.15);
    --shadow-pressed: 0 2px 4px rgba(1, 4, 9, 0.15), inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Accessibility Styles */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--accent-primary);
    color: var(--text-inverse);
    padding: 8px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    outline: 2px solid var(--text-inverse);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators for better accessibility */
*:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* High contrast focus for light theme */
[data-theme="light"] *:focus {
    outline: 2px solid var(--accent-primary-dark);
}

/* Enhanced focus styles for interactive elements */
.nav-item:focus,
.btn:focus,
.add-btn:focus,
button.add-btn:focus,
.form-input:focus,
.form-textarea:focus,
.filter-select:focus,
.sort-select:focus {
    outline: 3px solid var(--accent-primary);
    outline-offset: 2px;
    position: relative;
    z-index: 1;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #ffffff;
        --bg-primary: #000000;
        --bg-secondary: #111111;
        --bg-tertiary: #222222;
        --border-primary: #ffffff;
        --accent-primary: #00ff00;
    }
    
    [data-theme="light"] {
        --text-primary: #000000;
        --text-secondary: #000000;
        --bg-primary: #ffffff;
        --bg-secondary: #f0f0f0;
        --bg-tertiary: #e0e0e0;
        --border-primary: #000000;
        --accent-primary: #0000ff;
    }
    
    .item,
    .song-item,
    .practice-session-card {
        border-width: 2px;
    }
    
    .btn,
    .nav-item {
        border: 2px solid currentColor;
    }
}

/* Focus trap styling for modals */
.modal-overlay.focus-trap {
    outline: none;
}

/* Keyboard navigation indicators */
.keyboard-navigation .item:focus,
.keyboard-navigation .song-item:focus {
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.3);
    outline: none;
}

/* Category Icons - Clean, minimal styling */
.category-icon {
    display: inline-block;
    font-style: normal;
    margin-right: 8px;
    font-size: 1.1em;
    opacity: 0.9;
}

/* Tab order improvements */
.item[tabindex="0"],
.song-item[tabindex="0"] {
    cursor: pointer;
}

.item[tabindex="-1"],
.song-item[tabindex="-1"] {
    cursor: default;
}

/* Improved color contrast ratios */
.text-muted,
.item-meta,
.archive-item-meta {
    color: var(--text-tertiary);
}

/* Ensure sufficient contrast for interactive elements */
.star {
    filter: brightness(1.2);
}

.star.empty {
    opacity: 0.4;
    filter: brightness(0.8);
}

/* Better visual hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5em;
}

/* Status indicators with better contrast */
.item-count,
.item-count-badge,
.category-badge {
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Focus indicators for custom controls */
.star-btn:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    background: var(--bg-accent);
}

.rating-selector:focus-within {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 80px;
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid var(--border-primary);
    box-shadow: var(--shadow-md);
}

.app-title {
    font-family: var(--font-body);
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.streak-info {
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--accent-orange);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.streak-bar {
    display: flex;
    gap: 3px;
}

.streak-day {
    width: 12px;
    height: 12px;
    background: var(--accent-orange);
    border-radius: 1px;
}

.streak-day.empty {
    background: var(--bg-accent);
}

/* Sections */
.section {
    background: var(--bg-elevated);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.section-header {
    background: var(--bg-tertiary);
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    line-height: 1.3;
}

.next-session-header {
    background: var(--bg-session);
    color: var(--accent-green);
}

.section-content {
    padding: 20px;
}

.item-count {
    font-family: var(--font-mono);
    background: var(--accent-success);
    color: var(--text-inverse);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Enhanced Drop Zone with Magnetic Attraction Effects */
.drop-zone {
    border: 2px dashed var(--border-primary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    min-height: 120px;
    background: var(--bg-archive);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(63, 185, 80, 0.1),
        transparent
    );
    transition: left 0.6s ease;
    pointer-events: none;
}

.drop-zone.has-items {
    border: 2px solid var(--accent-success);
    background: var(--accent-surface);
    box-shadow: var(--shadow-md);
}

.drop-zone.drag-over {
    background: var(--accent-surface-hover);
    border: 2px solid var(--accent-primary);
    transform: scale(1.02);
    box-shadow: var(--shadow-hover), 
                0 0 0 4px rgba(63, 185, 80, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: magneticPulse 1.2s ease-in-out infinite;
}

.drop-zone.drag-over::before {
    left: 100%;
    transition: left 0.8s ease;
}

.drop-zone.magnetic-attraction {
    border: 2px solid var(--accent-primary-light);
    background: var(--accent-surface);
    transform: scale(1.01);
    box-shadow: var(--shadow-lg), 
                0 0 0 2px rgba(63, 185, 80, 0.2);
    animation: magneticBreathing 2s ease-in-out infinite;
}

/* Magnetic Attraction Animations */
@keyframes magneticPulse {
    0%, 100% {
        box-shadow: var(--shadow-hover), 
                    0 0 0 4px rgba(63, 185, 80, 0.1),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: var(--shadow-xl), 
                    0 0 0 8px rgba(63, 185, 80, 0.2),
                    inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
}

@keyframes magneticBreathing {
    0%, 100% {
        transform: scale(1.01);
        border-color: var(--accent-primary-light);
    }
    50% {
        transform: scale(1.015);
        border-color: var(--accent-primary);
    }
}

.empty-message {
    text-align: center;
    color: var(--text-meta);
    font-style: italic;
    margin-top: 40px;
}

/* Practice Items in Session */
.practice-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-success);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--accent-success);
    cursor: move;
    /* Subtle surface tinting */
    background: var(--accent-surface);
}

.practice-item:last-child {
    margin-bottom: 0;
}

.remove-btn {
    background: var(--accent-danger);
    color: white;
    border: none;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.remove-btn:hover {
    background: var(--accent-red-hover);
}

/* Regular Items */
.item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    /* Consistent item shadows using CSS variables */
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.item:hover {
    border-color: var(--accent-primary);
    background: var(--accent-surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    cursor: grab;
}

/* Enhanced hover anticipation for draggable items */
.item:hover:not(.dragging):not(.editing) {
    animation: hoverAnticipation 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes hoverAnticipation {
    0% {
        transform: translateY(0) scale(1);
    }
    60% {
        transform: translateY(-3px) scale(1.01);
    }
    100% {
        transform: translateY(-2px) scale(1.005);
    }
}

/* Snap-to-place success animation */
@keyframes snapToPlace {
    0% {
        transform: scale(1.1);
        background: var(--accent-surface-hover);
    }
    50% {
        transform: scale(0.95);
        background: var(--accent-surface);
    }
    100% {
        transform: scale(1);
        background: var(--accent-surface);
    }
}

.item.snap-success,
.song-item.snap-success {
    animation: snapToPlace 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.item.dragging {
    opacity: 0.85;
    transform: rotate(2deg) scale(1.05);
    box-shadow: var(--shadow-2xl), 
                0 0 0 2px var(--accent-primary),
                0 0 20px rgba(63, 185, 80, 0.4);
    border: 2px solid var(--accent-primary);
    z-index: 1000;
    background: var(--accent-surface);
    animation: dragFloat 2s ease-in-out infinite;
    cursor: grabbing;
    transition: none; /* Remove transition during drag for immediate response */
}

.item.drag-preview {
    opacity: 0.9;
    transform: rotate(1deg) scale(1.02);
    box-shadow: var(--shadow-lg), 
                0 0 0 1px var(--accent-primary-light),
                0 0 10px rgba(63, 185, 80, 0.2);
    border: 1px solid var(--accent-primary-light);
    background: var(--accent-surface);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Drag Animations */
@keyframes dragFloat {
    0%, 100% {
        transform: rotate(2deg) scale(1.05) translateY(0);
    }
    50% {
        transform: rotate(2deg) scale(1.05) translateY(-2px);
    }
}

/* Drag Initiation Animation */
@keyframes dragInitiate {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02) rotate(1deg);
    }
    100% {
        transform: scale(1.05) rotate(2deg);
    }
}

.item.drag-initiating {
    animation: dragInitiate 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.item-header {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.item-info {
    flex: 1;
}

.item-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.item-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 15px;
    line-height: 1.4;
}

.rating {
    display: flex;
    gap: 2px;
}

.star {
    color: var(--accent-yellow);
    font-size: 0.9rem;
}

.star.empty {
    color: var(--bg-accent);
}

/* Item Expansion */
.item.expanded {
    border-color: var(--accent-success);
    background: var(--accent-surface);
}

.item-content {
    padding: 0 15px 15px;
    border-top: 1px solid var(--border-primary);
    margin-top: 10px;
    padding-top: 15px;
}

.item-description {
    color: var(--text-primary);
    line-height: 1.4;
    padding: 10px 15px 5px;
    font-size: 0.9rem;
}

.item-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Item Editing */
.item.editing {
    border-color: var(--accent-warning);
    background: var(--accent-surface);
}

.edit-form {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-input, .form-textarea {
    width: 100%;
    background: var(--bg-accent);
    border: 1px solid var(--border-secondary);
    border-radius: 3px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    transform: translateY(-1px);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.4;
}

/* Tag Input */
.tag-input-container {
    position: relative;
}

#song-tags-input {
    padding-right: 2.5rem;
}

.tag-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    margin-top: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 20;
}

.tag-autocomplete.hidden {
    display: none;
}

.tag-option {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-secondary);
    transition: background 0.2s ease;
}

.tag-option:last-child {
    border-bottom: none;
}

.tag-option:hover,
.tag-option.highlighted {
    background: var(--bg-secondary);
}

.tag-category-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.selected-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    min-height: 32px;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background: var(--accent-surface);
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.tag-chip-remove {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-tertiary);
    transition: color 0.2s ease, transform 0.2s ease;
}

.tag-chip-remove:hover,
.tag-chip-remove:focus {
    color: var(--accent-primary);
    transform: scale(1.1);
}

.form-hint {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

.song-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-left: 15px;
    padding-right: 15px;
}

.song-tag-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-secondary);
}

.song-tags-inline {
    margin-top: 0.35rem;
    margin-bottom: 0.5rem;
}

.song-tags-empty {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.rating-selector {
    display: flex;
    gap: 3px;
    align-items: center;
}

.star-btn {
    background: none;
    border: none;
    color: var(--bg-accent);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.star-btn:hover {
    background: var(--bg-accent);
    color: var(--accent-yellow);
    transform: scale(1.1);
}

.star-btn:active {
    transform: scale(0.95);
}

.star-btn.active {
    color: var(--accent-yellow);
    transform: scale(1.05);
}

.clear-rating-btn {
    background: var(--text-meta);
    color: var(--text-inverse);
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 10px;
    transition: background 0.2s ease;
}

.clear-rating-btn:hover {
    background: var(--border-secondary);
}

/* Buttons */
.btn {
    background: var(--accent-success);
    color: var(--text-inverse);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    box-shadow: var(--shadow-md);
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    background: var(--accent-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition-duration: 0.05s;
}

.btn:disabled {
    background: var(--text-meta);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--text-meta);
    color: var(--text-inverse);
}

.btn-secondary:hover {
    background: var(--text-tertiary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(107, 114, 128, 0.25);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition-duration: 0.05s;
}

.btn-danger {
    background: var(--accent-danger);
    color: white;
}

.btn-danger:hover {
    background: var(--accent-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition-duration: 0.05s;
}

.btn-archive {
    background: var(--accent-archive);
    color: white;
}

.btn-archive:hover {
    background: var(--accent-archive-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
}

.btn-archive:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    transition-duration: 0.05s;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Add Button - Updated for button element */
.add-btn,
button.add-btn {
    background: var(--bg-accent);
    color: var(--text-primary);
    border: 1px dashed var(--border-secondary);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

.add-btn:hover,
button.add-btn:hover {
    background: var(--accent-surface);
    border-color: var(--accent-success);
    color: var(--accent-success);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-style: solid;
    font-weight: 600;
}

.add-btn:active,
button.add-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Session Buttons */
.session-buttons {
    display: flex;
    gap: 10px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 12px 12px 0 0;
    padding: 15px;
    display: flex;
    gap: 20px;
    z-index: 1000;
    box-shadow: var(--shadow-xl);
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
    position: relative;
}

.nav-item:hover {
    background: var(--accent-surface);
    color: var(--accent-primary);
    transform: translateY(-1px);
}

.nav-item.active {
    background: var(--accent-primary);
    color: var(--text-inverse);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal-overlay);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

/* Sign-in overlay for multi-device sync (separate from the generic modal
   system so it can't be dismissed by the existing outside-click/closeModal
   handlers). */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal-overlay);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.auth-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.15);
}

.auth-box h2 {
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.auth-subtitle {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin: 0 0 20px;
}

.auth-link-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--accent-primary);
    font-size: 0.85rem;
    padding: 10px 0 0;
    cursor: pointer;
    text-align: center;
}

.auth-link-btn:hover {
    text-decoration: underline;
}

.auth-offline-btn {
    color: var(--text-tertiary);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    color: var(--text-secondary);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.close-btn:hover {
    background: var(--bg-accent);
    color: var(--text-secondary);
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal-body {
    padding: 20px;
}

.modal-body ul {
    margin: 10px 0;
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Three Column Layout for Practice Sections */
.practice-sections {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Repertoire Page Controls */
.repertoire-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-select, .sort-select {
    background: var(--bg-accent);
    border: 1px solid var(--border-secondary);
    border-radius: 3px;
    padding: 6px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-select:hover, .sort-select:hover {
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.filter-select:focus, .sort-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    transform: translateY(-1px);
}

/* Song Cards */
.song-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    /* Card shadows for visual depth */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.song-item:hover {
    border-color: var(--accent-primary);
    background: var(--accent-surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    cursor: grab;
}

.song-item:hover:not(.dragging):not(.editing) {
    animation: hoverAnticipation 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.song-item.dragging {
    opacity: 0.85;
    transform: rotate(2deg) scale(1.05);
    box-shadow: var(--shadow-2xl), 
                0 0 0 2px var(--accent-primary),
                0 0 20px rgba(63, 185, 80, 0.4);
    border: 2px solid var(--accent-primary);
    z-index: 1000;
    background: var(--accent-surface);
    animation: dragFloat 2s ease-in-out infinite;
    cursor: grabbing;
    transition: none;
}

.song-item.drag-preview {
    opacity: 0.9;
    transform: rotate(1deg) scale(1.02);
    box-shadow: var(--shadow-lg), 
                0 0 0 1px var(--accent-primary-light),
                0 0 10px rgba(63, 185, 80, 0.2);
    border: 1px solid var(--accent-primary-light);
    background: var(--accent-surface);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.song-item.drag-initiating {
    animation: dragInitiate 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.song-links {
    position: absolute;
    top: 12px;
    right: 50px;
    display: flex;
    gap: 8px;
    z-index: 1;
}

.link-icon {
    background: var(--bg-accent);
    border: none;
    border-radius: 6px;
    padding: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.link-icon:hover {
    background: var(--bg-tertiary);
    transform: scale(1.15) translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.link-icon.tab-link {
    background: var(--bg-accent);
}

.link-icon.tab-link:hover {
    background: var(--bg-tertiary);
}

.link-icon.youtube-link {
    background: var(--bg-accent);
}

.link-icon.youtube-link:hover {
    background: var(--bg-tertiary);
}

/* Archive Page Styles */
.search-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-container input {
    flex: 1;
}

.archive-section-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.archive-header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.collapse-icon {
    font-size: 1rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.collapse-icon:hover {
    color: var(--accent-primary);
    transform: scale(1.1);
}

.archive-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.archive-section.collapsed .collapse-icon:hover {
    transform: rotate(-90deg) scale(1.1);
}

.archive-section-content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.archive-section.collapsed .archive-section-content {
    display: none;
}

.archive-bulk-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 15px;
}

.bulk-selection {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bulk-selection input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-success);
    cursor: pointer;
}

.bulk-selection label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.bulk-actions {
    display: flex;
    gap: 10px;
}

/* Archive Item Styles */
.archive-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 10px;
    position: relative;
}

.archive-item-checkbox {
    position: absolute;
    top: 12px;
    left: 15px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-success);
    cursor: pointer;
    z-index: 1;
}

.archive-item .item-header {
    padding-left: 45px;
}

.archive-item .item-description {
    padding-left: 45px;
}

.archive-item-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.archive-date {
    color: var(--accent-yellow);
}

.archive-reason {
    color: var(--accent-success);
}

.archive-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.restore-btn {
    background: var(--accent-success);
    color: var(--text-inverse);
}

.restore-btn:hover {
    background: var(--accent-primary-dark);
}

.permanent-delete-btn {
    background: var(--accent-danger);
    color: white;
}

.permanent-delete-btn:hover {
    background: var(--accent-red-hover);
}

/* Empty Archive Styles */
.empty-message {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

.empty-message h3 {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.empty-message p {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 1024px) {
    .practice-sections {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header .app-title {
        font-size: 1.5rem;
    }

    .practice-sections {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .bottom-nav {
        flex-direction: column;
        gap: 5px;
        width: 90%;
        max-width: 300px;
    }

    .session-buttons {
        flex-direction: column;
    }

    .item-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .repertoire-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .filter-select, .sort-select {
        width: 100%;
    }
    
    .archive-bulk-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .bulk-actions {
        justify-content: center;
    }
    
    .archive-header-controls {
        gap: 10px;
    }
    
    .archive-item-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    /* Practice Log responsive */
    .filter-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .filter-controls select {
        width: 100%;
    }
    
    .session-meta {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .session-categories {
        gap: 6px;
    }
    
    .session-items {
        gap: 10px;
    }
    
    .session-category {
        padding: 12px;
    }
}

/* Hidden by default - will show different pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Settings Page Styles */
.settings-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    gap: 20px;
}

.setting-item.danger-zone {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.setting-info {
    flex: 1;
}

.setting-info h4 {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 5px;
}

.setting-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.theme-toggle, .streak-unit-toggle {
    display: flex;
    gap: 15px;
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.toggle-option:hover {
    background: var(--bg-accent);
}

.toggle-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-success);
    cursor: pointer;
}

.toggle-option span {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.import-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.streak-modify {
    display: flex;
    align-items: center;
    gap: 10px;
}

.streak-modify input {
    width: 80px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Practice Log Page Styles */
.log-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.log-stats {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Practice Session Cards */
.practice-session-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* Session card depth with subtle shadows */
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
}

.practice-session-card:hover {
    border-color: var(--accent-primary);
    background: var(--accent-surface);
    /* Enhanced session card hover with refined animation */
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.session-header {
    padding: 15px 20px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-header:hover {
    background: var(--bg-accent);
}

.session-info {
    flex: 1;
}

.session-date {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.session-meta {
    display: flex;
    gap: 20px;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.session-summary {
    display: flex;
    gap: 15px;
    align-items: center;
}

.item-count-badge {
    font-family: var(--font-mono);
    background: var(--accent-success);
    color: var(--text-inverse);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.session-categories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-badge {
    font-family: var(--font-body);
    background: var(--bg-accent);
    color: var(--text-primary);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid var(--border-primary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-weight: 600;
}

.category-badge.technical { border-color: var(--color-technical); color: var(--color-technical); }
.category-badge.theory { border-color: var(--color-theory); color: var(--color-theory); }
.category-badge.creative { border-color: var(--color-creative); color: var(--color-creative); }
.category-badge.repertoire { border-color: var(--color-repertoire); color: var(--color-repertoire); }

.expand-indicator {
    font-size: 1.2rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.practice-session-card.expanded .expand-indicator {
    transform: rotate(180deg);
}

/* Session Details (Expandable Content) */
.session-details {
    display: none;
    padding: 0 20px 20px;
    border-top: 1px solid var(--border-primary);
}

.practice-session-card.expanded .session-details {
    display: block;
}

.session-notes {
    background: var(--accent-surface);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    border-left: 4px solid var(--accent-success);
}

.session-notes h4 {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-notes p {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    font-style: italic;
}

.session-notes.no-notes p {
    color: var(--text-muted);
    font-style: italic;
}

.session-items {
    display: grid;
    gap: 15px;
}

.session-category {
    background: var(--bg-archive);
    border-radius: 6px;
    padding: 15px;
}

.session-category-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-category-items {
    display: grid;
    gap: 8px;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-primary);
}

.session-item-info {
    flex: 1;
}

.session-item-title {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.session-item-links {
    display: flex;
    gap: 8px;
}

.session-link-icon {
    background: var(--bg-accent);
    border: none;
    border-radius: 4px;
    padding: 6px;
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.session-link-icon:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

.session-link-icon.tab-link {
    background: var(--bg-accent);
}

.session-link-icon.tab-link:hover {
    background: var(--bg-tertiary);
}

.session-link-icon.youtube-link {
    background: var(--bg-accent);
}

.session-link-icon.youtube-link:hover {
    background: var(--bg-tertiary);
}

/* Theme transition for smooth switching */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Celebration and Success Animations */
@keyframes celebrationPulse {
    0% { 
        transform: scale(1); 
        box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2);
    }
    50% { 
        transform: scale(1.05); 
        box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    }
    100% { 
        transform: scale(1); 
        box-shadow: 0 4px 8px rgba(16, 185, 129, 0.2);
    }
}

@keyframes celebrationBounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-8px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-4px); }
}

@keyframes successGlow {
    0% { 
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
        border-color: var(--accent-primary);
    }
    70% { 
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
        border-color: var(--accent-primary);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
        border-color: var(--accent-primary);
    }
}

.session-complete-animation {
    animation: celebrationPulse 0.6s ease-out;
}

.success-bounce {
    animation: celebrationBounce 0.8s ease-out;
}

.success-glow {
    animation: successGlow 1.2s ease-out;
}

/* Item completion celebration */
.item-completed {
    animation: successGlow 1s ease-out;
}

/* Loading State Animations */
@keyframes shimmer {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes skeletonPulse {
    0% { background-color: var(--bg-accent); }
    50% { background-color: var(--border-primary); }
    100% { background-color: var(--bg-accent); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideInFromRight {
    from { 
        transform: translateX(100%);
        opacity: 0;
    }
    to { 
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from { 
        transform: translateX(-100%);
        opacity: 0;
    }
    to { 
        transform: translateX(0);
        opacity: 1;
    }
}

.loading-state {
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-loading {
    animation: skeletonPulse 2s ease-in-out infinite;
    border-radius: 4px;
}

.spinner {
    animation: spin 1s linear infinite;
}

.slide-in-right {
    animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-in-left {
    animation: slideInFromLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Page transition animations */
.page-enter {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal animations */
@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-enter {
    animation: modalEnter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.item, .section {
    animation: fadeIn 0.3s ease-out;
}

/* Error and success states with high contrast */
.form-input:invalid,
.form-textarea:invalid {
    border-color: var(--accent-danger);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.form-input:valid,
.form-textarea:valid {
    border-color: var(--accent-success);
}

/* Form error messages */
.error-message {
    color: var(--accent-danger);
    font-size: 0.85rem;
    margin-top: 4px;
    font-weight: 500;
}

.error-message:before {
    content: '⚠ ';
    font-weight: bold;
}

/* Required field indicators */
.form-label[required]:after,
.form-label[aria-required="true"]:after {
    content: ' *';
    color: var(--accent-danger);
    font-weight: bold;
}

/* Fieldset and legend styling for better accessibility */
fieldset {
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

legend {
    padding: 0 8px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Better loading states */
.loading-state {
    background: linear-gradient(
        90deg,
        var(--bg-accent) 0%,
        var(--border-primary) 50%,
        var(--bg-accent) 100%
    );
    background-size: 200% 100%;
    animation: loading 2s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Keyboard alternative instructions */
.keyboard-instructions {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-accent);
    border-radius: 4px;
    border-left: 3px solid var(--accent-primary);
}

/* Touch target size for mobile accessibility */
@media (max-width: 768px) {
    .nav-item,
    .btn,
    .add-btn,
    button.add-btn,
    .star-btn,
    .close-btn {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .link-icon,
    .session-link-icon {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Larger tap targets for better mobile accessibility */
    .item,
    .song-item,
    .practice-item {
        min-height: 48px;
        padding: 12px;
    }
    
    .remove-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve mobile form controls */
    .form-input,
    .form-textarea,
    .filter-select,
    .sort-select {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Better mobile spacing */
    .section-header {
        padding: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
}

/* Accessibility: Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .item:hover,
    .song-item:hover,
    .practice-session-card:hover,
    .btn:hover,
    .btn-secondary:hover,
    .btn-danger:hover,
    .btn-archive:hover,
    .add-btn:hover,
    .nav-item:hover,
    .nav-item.active,
    .star-btn:hover,
    .star-btn.active,
    .form-input:focus,
    .form-textarea:focus,
    .filter-select:hover,
    .sort-select:hover,
    .filter-select:focus,
    .sort-select:focus,
    .collapse-icon:hover {
        transform: none;
    }
    
    .item.dragging,
    .song-item.dragging {
        opacity: 0.5;
        transform: none;
        box-shadow: none;
        border: 2px solid var(--accent-primary);
    }
    
    .drop-zone.drag-over {
        transform: none;
        box-shadow: none;
    }
}

/* Quick Add to Session Icon */
.quick-add-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--accent-primary);
    color: var(--text-inverse);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    opacity: 0;
    transform: scale(0.8);
    user-select: none;
}

.item:hover .quick-add-btn,
.item:focus-within .quick-add-btn {
    opacity: 1;
    transform: scale(1);
}

.quick-add-btn:hover {
    background: var(--accent-primary-dark);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.quick-add-btn:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    background: var(--accent-primary-dark);
}

.quick-add-btn:active {
    transform: scale(0.95);
    box-shadow: var(--shadow-sm);
}

.quick-add-btn.adding {
    background: var(--accent-success);
    animation: quickAddSuccess 0.6s ease-out;
}

.quick-add-btn.disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.quick-add-btn.disabled:hover {
    transform: scale(1);
    background: var(--text-muted);
}

/* Quick Add Success Animation */
@keyframes quickAddSuccess {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
        background: var(--accent-success);
    }
    50% {
        transform: scale(1.1);
    }
    75% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
        background: var(--accent-primary);
    }
}

/* Quick Add Icon Content */
.quick-add-btn .icon {
    transition: transform 0.2s ease;
}

.quick-add-btn.adding .icon {
    transform: rotate(90deg);
}



/* Mobile/Touch Optimizations */
@media (hover: none) and (pointer: coarse) {
    .quick-add-btn {
        opacity: 1;
        transform: scale(1);
        width: 36px;
        height: 36px;
        top: 6px;
        right: 6px;
        font-size: 18px;
    }
    
    .item .quick-add-btn {
        opacity: 0.8;
    }
    
    .item:hover .quick-add-btn,
    .item:focus-within .quick-add-btn {
        opacity: 1;
    }
    
    .song-links {
        right: 50px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .quick-add-btn {
        border: 2px solid var(--text-primary);
        background: var(--accent-primary);
    }
    
    .quick-add-btn:focus {
        outline: 3px solid var(--accent-primary);
        outline-offset: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .quick-add-btn {
        transition: opacity 0.2s ease;
        animation: none;
    }
    
    .quick-add-btn:hover,
    .quick-add-btn:active {
        transform: none;
    }
    
    .quick-add-btn.adding {
        animation: none;
        background: var(--accent-success);
    }

    .item:hover:not(.dragging):not(.editing),
    .song-item:hover:not(.dragging):not(.editing),
    .btn:hover:not(:disabled),
    .add-btn:hover,
    button.add-btn:hover {
        animation: none;
    }
    
    .success-reaction,
    .data-processing,
    .session-complete-animation {
        animation: none;
        background: var(--accent-surface);
        border-color: var(--accent-primary);
    }
    
    .item.drag-preview,
    .song-item.drag-preview {
        animation: none;
        opacity: 0.9;
    }
    
    .drop-zone.drag-over {
        animation: none;
        background: var(--accent-surface-hover);
        border: 2px solid var(--accent-primary);
    }
}
