/**
 * Custom CSS for Sistema de Cadastro de Música
 * Bootstrap 5 customizations and additional styles
 */

/* Root variables for theme support */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Dark theme variables */
[data-bs-theme="dark"] {
    --bs-body-bg: #212529;
    --bs-body-color: #dee2e6;
    --bs-border-color: #495057;
}

/* Global styles */
body {
    font-family: var(--font-family-sans-serif);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Skip to content link for accessibility */
.visually-hidden-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
}

/* Icon fallbacks - ensure icons display even if CDN fails */
.bi::before, .fas::before, .far::before, .fab::before {
    font-family: "bootstrap-icons", "Font Awesome 6 Free", "Font Awesome 6 Brands", sans-serif !important;
}

/* Fallback for missing icons */
.bi-house::before { content: "🏠"; }
.bi-search::before { content: "🔍"; }
.bi-music-note-beamed::before { content: "🎵"; }
.bi-gear::before { content: "⚙️"; }
.bi-person-circle::before { content: "👤"; }
.bi-box-arrow-in-right::before { content: "🔑"; }
.bi-box-arrow-right::before { content: "🚪"; }
.bi-speedometer2::before { content: "📊"; }
.bi-music-note-list::before { content: "📝"; }
.bi-tags::before { content: "🏷️"; }
.bi-people::before { content: "👥"; }
.bi-journal-text::before { content: "📋"; }
.bi-sun-fill::before { content: "☀️"; }
.bi-moon-fill::before { content: "🌙"; }

/* Font Awesome fallbacks */
.fas.fa-home::before { content: "🏠"; }
.fas.fa-search::before { content: "🔍"; }
.fas.fa-music::before { content: "🎵"; }
.fas.fa-cog::before { content: "⚙️"; }
.fas.fa-user-circle::before { content: "👤"; }
.fas.fa-sign-in-alt::before { content: "🔑"; }
.fas.fa-sign-out-alt::before { content: "🚪"; }
.fas.fa-tachometer-alt::before { content: "📊"; }
.fas.fa-list-alt::before { content: "📝"; }
.fas.fa-tags::before { content: "🏷️"; }
.fas.fa-users::before { content: "👥"; }
.fas.fa-file-alt::before { content: "📋"; }
.fas.fa-sun::before { content: "☀️"; }
.fas.fa-moon::before { content: "🌙"; }

/* Music card styling */
.music-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.music-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Search form styling */
.search-no-results {
    text-align: center;
    padding: 3rem 1rem;
}

.search-no-results i {
    font-size: 4rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

/* Navbar customizations */
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    transform: translateY(-1px);
}

.navbar-nav .dropdown-menu {
    border: none;
    box-shadow: var(--box-shadow-lg);
    border-radius: var(--border-radius);
}

/* Card enhancements */
.card {
    border: none;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    border: none;
    font-weight: 600;
}

/* Button enhancements */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
}

/* Form enhancements */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
}

[data-bs-theme="dark"] .form-label {
    color: var(--light-color);
}

/* Table enhancements */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table thead th {
    background: var(--light-color);
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

[data-bs-theme="dark"] .table thead th {
    background: var(--dark-color);
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

/* Alert enhancements */
.alert {
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
}

.alert-dismissible .btn-close {
    padding: 1rem;
}

/* Badge enhancements */
.badge {
    font-weight: 500;
    border-radius: var(--border-radius);
}

/* Music presentation styles */
.music-presentation {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
    padding: 2rem;
    margin: 1rem 0;
}

[data-bs-theme="dark"] .music-presentation {
    background: var(--dark-color);
}

.music-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.music-author {
    font-size: 1.25rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.music-category {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.music-content {
    font-family: var(--font-family-monospace);
    font-size: 1rem;
    line-height: 1.8;
    white-space: pre-wrap;
    background: var(--light-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

[data-bs-theme="dark"] .music-content {
    background: #343a40;
}

.music-chords {
    color: var(--primary-color);
    font-weight: 700;
}

/* Enhanced music presentation styles */
.music-presentation-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.music-presentation-header {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
}

.music-presentation-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.music-lyrics {
    font-size: 1.1rem;
    line-height: 1.8;
    white-space: pre-line;
    padding: 1.5rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin-bottom: 1rem;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
}

[data-bs-theme="dark"] .music-lyrics {
    background: #343a40;
    color: #dee2e6;
}

.music-chords {
    font-family: var(--font-family-monospace);
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre;
    padding: 1.5rem;
    background: var(--light-color);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
    margin-bottom: 1rem;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
}

[data-bs-theme="dark"] .music-chords {
    background: #343a40;
    color: #dee2e6;
}

/* Presentation mode for desktop */
@media (min-width: 1200px) {
    .presentation-mode .music-lyrics,
    .presentation-mode .music-chords {
        font-size: 1.3rem;
        line-height: 2;
        max-height: calc(100vh - 200px);
        padding: 2rem;
    }
    
    .presentation-mode .music-presentation-header {
        padding: 2rem 0;
    }
    
    .presentation-mode .music-title {
        font-size: 2.5rem;
    }
    
    .presentation-mode .music-author {
        font-size: 1.5rem;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .music-presentation-header {
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
    
    .music-lyrics,
    .music-chords {
        font-size: 1rem;
        line-height: 1.6;
        padding: 1rem;
        max-height: none; /* Allow scrolling on mobile */
        border-left-width: 3px;
    }
    
    .music-title {
        font-size: 1.5rem;
    }
    
    .music-author {
        font-size: 1.1rem;
    }
    
    /* Mobile-specific scrolling enhancements */
    .music-lyrics,
    .music-chords {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    /* Tab navigation improvements for mobile */
    .nav-tabs {
        border-bottom: 2px solid var(--primary-color);
    }
    
    .nav-tabs .nav-link {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        border: none;
        border-bottom: 3px solid transparent;
        background: none;
        color: var(--secondary-color);
        font-weight: 500;
    }
    
    .nav-tabs .nav-link.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
        background: none;
    }
    
    .nav-tabs .nav-link:hover {
        border-bottom-color: var(--primary-color);
        color: var(--primary-color);
    }
}

@media (max-width: 576px) {
    .music-lyrics,
    .music-chords {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
    
    .music-title {
        font-size: 1.25rem;
    }
    
    .music-author {
        font-size: 1rem;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Mobile-specific improvements */
    .music-presentation-header {
        padding: 0.75rem 0;
    }
    
    .music-presentation-header .btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
    }
    
    .music-presentation-header .btn span {
        display: none !important;
    }
    
    /* Improve touch targets */
    .nav-tabs .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Better video handling on mobile */
    .ratio {
        margin-bottom: 1rem;
    }
    
    .card-footer .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Presentation controls for mobile */
    .presentation-controls {
        bottom: 10px !important;
        right: 10px !important;
        left: auto !important;
        top: auto !important;
    }
    
    .auto-scroll-controls {
        bottom: 10px !important;
        right: 10px !important;
        left: auto !important;
    }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .music-presentation-header {
        padding: 0.5rem 0;
    }
    
    .music-title {
        font-size: 1.1rem;
    }
    
    .music-author {
        font-size: 0.9rem;
    }
    
    .music-lyrics,
    .music-chords {
        max-height: calc(100vh - 150px);
        font-size: 0.85rem;
        line-height: 1.4;
    }
    
    /* Hide video in landscape to maximize lyrics space */
    .presentation-mode .ratio {
        display: none;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .music-lyrics,
    .music-chords {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Video container */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    margin: 1.5rem 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Enhanced video embedding */
.ratio iframe {
    border-radius: var(--border-radius);
}

.video-fallback {
    background: var(--light-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-bs-theme="dark"] .video-fallback {
    background: #343a40;
}

.video-error-icon {
    font-size: 3rem;
    color: var(--warning-color);
    margin-bottom: 1rem;
}

/* Presentation controls */
.presentation-controls {
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    backdrop-filter: blur(10px);
}

.presentation-controls .btn {
    margin: 0.125rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.presentation-controls .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.auto-scroll-controls {
    background: rgba(0, 0, 0, 0.8);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    backdrop-filter: blur(10px);
}

.auto-scroll-controls .btn {
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.8rem;
}

.auto-scroll-controls .btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Search and filter styles */
.search-container {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
}

.search-form .form-control {
    border: none;
    box-shadow: var(--box-shadow);
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
}

.filter-tabs .nav-link {
    color: var(--secondary-color);
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    margin-right: 0.5rem;
    transition: all 0.3s ease;
}

.filter-tabs .nav-link.active {
    background: var(--primary-color);
    color: white;
}

.filter-tabs .nav-link:hover {
    background: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
}

/* Music list styles */
.music-item {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

[data-bs-theme="dark"] .music-item {
    background: var(--dark-color);
}

.music-item:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.music-item-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.music-item-author {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.music-item-preview {
    font-size: 0.9rem;
    color: var(--secondary-color);
    line-height: 1.4;
}

/* Pagination styles */
.pagination .page-link {
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    margin: 0 0.125rem;
    border-radius: var(--border-radius);
}

.pagination .page-link:hover {
    background: var(--primary-color);
    color: white;
}

.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .music-presentation {
        padding: 1rem;
        margin: 0.5rem 0;
    }
    
    .music-title {
        font-size: 1.5rem;
    }
    
    .music-content {
        font-size: 0.9rem;
        padding: 1rem;
    }
    
    .search-container {
        padding: 2rem 0;
    }
    
    .music-item {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .music-title {
        font-size: 1.25rem;
    }
    
    .music-content {
        font-size: 0.85rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .pagination,
    footer,
    .modal,
    .alert {
        display: none !important;
    }
    
    .music-presentation {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .music-content {
        background: white !important;
        color: black !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.btn:focus,
.form-control:focus,
.form-select:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card,
    .music-item,
    .music-presentation {
        border: 2px solid var(--dark-color);
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--dark-color);
}

/* Utility classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: var(--box-shadow-lg) !important;
}

.border-custom {
    border: 2px solid var(--primary-color) !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3) !important;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}/* Sea
rch and filtering styles */
.search-container {
    position: relative;
}

.author-autocomplete {
    position: relative;
}

.author-autocomplete .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--border-radius);
    background-color: var(--bs-body-bg);
    box-shadow: var(--box-shadow-lg);
}

.author-autocomplete .dropdown-item {
    padding: 0.5rem 1rem;
    color: var(--bs-body-color);
    text-decoration: none;
    display: block;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.author-autocomplete .dropdown-item:hover,
.author-autocomplete .dropdown-item.active {
    background-color: var(--bs-primary);
    color: white;
}

/* Alphabetical filter styles */
.alphabet-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.alphabet-filter .btn {
    min-width: 2.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alphabet-filter .btn-sm {
    min-width: 2rem;
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
}

/* Search results styles */
.search-results {
    min-height: 300px;
}

.search-no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bs-secondary);
}

.search-no-results i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Music card enhancements */
.music-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: 1px solid var(--bs-border-color);
}

.music-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.music-card .card-title a {
    color: var(--bs-body-color);
    text-decoration: none;
}

.music-card .card-title a:hover {
    color: var(--bs-primary);
}

.music-card .badge {
    font-size: 0.75rem;
}

/* Search form enhancements */
.search-form .form-label {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.search-form .btn {
    white-space: nowrap;
}

/* Advanced filters toggle */
.advanced-filters {
    transition: all 0.3s ease-in-out;
}

.advanced-filters.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.advanced-filters.expanded {
    max-height: 500px;
    opacity: 1;
}

/* Loading states */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 1rem;
    top: 50%;
    left: 50%;
    margin-left: -0.5rem;
    margin-top: -0.5rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination enhancements */
.pagination .page-link {
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.pagination .page-link:hover {
    color: var(--bs-primary);
    background-color: var(--bs-light);
    border-color: var(--bs-border-color);
}

/* Search highlights */
.search-highlight {
    background-color: yellow;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

[data-bs-theme="dark"] .search-highlight {
    background-color: #ffc107;
    color: #000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .alphabet-filter {
        justify-content: center;
    }
    
    .alphabet-filter .btn {
        min-width: 2rem;
        padding: 0.125rem 0.25rem;
        font-size: 0.75rem;
    }
    
    .search-form .col-md-4,
    .search-form .col-md-3,
    .search-form .col-md-2 {
        margin-bottom: 1rem;
    }
    
    .music-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .alphabet-filter .btn {
        min-width: 1.75rem;
        padding: 0.125rem 0.125rem;
        font-size: 0.7rem;
    }
    
    .search-form .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Print styles for music presentation */
@media print {
    .search-container,
    .alphabet-filter,
    .pagination,
    .btn,
    .navbar,
    footer {
        display: none !important;
    }
    
    .music-card {
        border: none;
        box-shadow: none;
        page-break-inside: avoid;
    }
    
    .music-card .card-body {
        padding: 0;
    }
}

/* Focus styles for accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .music-card {
        border-width: 2px;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .search-highlight {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .music-card,
    .advanced-filters,
    .btn-loading::after {
        transition: none;
        animation: none;
    }
}

/* Enhanced presentation mode optimizations */
.presentation-mode {
    background: var(--bs-body-bg);
    overflow: hidden;
}

.presentation-mode .navbar,
.presentation-mode .footer,
.presentation-mode .breadcrumb {
    display: none !important;
}

.presentation-mode .container-fluid {
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.presentation-mode .music-presentation-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.presentation-mode .music-presentation-header {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.presentation-mode .music-presentation-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.presentation-mode .tab-content {
    flex: 1;
    overflow: hidden;
}

.presentation-mode .tab-pane {
    height: 100%;
    overflow-y: auto;
}

/* Desktop presentation optimizations */
@media (min-width: 1200px) {
    .presentation-mode .music-lyrics,
    .presentation-mode .music-chords {
        font-size: 1.4rem;
        line-height: 2.2;
        padding: 2.5rem;
        height: calc(100vh - 250px);
        overflow-y: auto;
    }
    
    .presentation-mode .music-title {
        font-size: 3rem;
        margin-bottom: 0.5rem;
    }
    
    .presentation-mode .music-author {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .presentation-mode .music-category {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }
}

/* Tablet presentation optimizations */
@media (min-width: 768px) and (max-width: 1199px) {
    .presentation-mode .music-lyrics,
    .presentation-mode .music-chords {
        font-size: 1.2rem;
        line-height: 2;
        padding: 2rem;
        height: calc(100vh - 220px);
        overflow-y: auto;
    }
    
    .presentation-mode .music-title {
        font-size: 2.2rem;
    }
    
    .presentation-mode .music-author {
        font-size: 1.4rem;
    }
}

/* Mobile presentation optimizations */
@media (max-width: 767px) {
    .presentation-mode .music-presentation-container {
        padding: 0.5rem;
    }
    
    .presentation-mode .music-lyrics,
    .presentation-mode .music-chords {
        font-size: 1rem;
        line-height: 1.8;
        padding: 1rem;
        height: calc(100vh - 180px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .presentation-mode .music-title {
        font-size: 1.6rem;
    }
    
    .presentation-mode .music-author {
        font-size: 1.2rem;
    }
    
    .presentation-mode .nav-tabs .nav-link {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
}

/* Landscape mobile optimizations */
@media (max-width: 767px) and (orientation: landscape) {
    .presentation-mode .music-presentation-header {
        padding: 0.5rem 0;
        margin-bottom: 0.5rem;
    }
    
    .presentation-mode .music-title {
        font-size: 1.3rem;
        margin-bottom: 0.25rem;
    }
    
    .presentation-mode .music-author {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .presentation-mode .music-lyrics,
    .presentation-mode .music-chords {
        height: calc(100vh - 120px);
        font-size: 0.9rem;
        line-height: 1.6;
        padding: 0.75rem;
    }
    
    .presentation-mode .nav-tabs .nav-link {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Enhanced video container for presentation */
.presentation-mode .video-container {
    max-width: 400px;
    margin: 0 auto 1rem;
}

@media (max-width: 767px) {
    .presentation-mode .video-container {
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Keyboard navigation indicators */
.presentation-mode .nav-tabs .nav-link {
    position: relative;
}

.presentation-mode .nav-tabs .nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--bs-warning);
    transition: width 0.3s ease;
}

.presentation-mode .nav-tabs .nav-link:focus::after {
    width: 80%;
}

/* Enhanced scrollbar for presentation mode */
.presentation-mode .music-lyrics::-webkit-scrollbar,
.presentation-mode .music-chords::-webkit-scrollbar {
    width: 12px;
}

.presentation-mode .music-lyrics::-webkit-scrollbar-track,
.presentation-mode .music-chords::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.presentation-mode .music-lyrics::-webkit-scrollbar-thumb,
.presentation-mode .music-chords::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.presentation-mode .music-lyrics::-webkit-scrollbar-thumb:hover,
.presentation-mode .music-chords::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Dynamic form interactions */
.form-floating-enhanced {
    position: relative;
}

.form-floating-enhanced .form-control {
    padding-top: 1.625rem;
    padding-bottom: 0.625rem;
    transition: all 0.3s ease;
}

.form-floating-enhanced .form-control:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.15);
}

.form-floating-enhanced label {
    transition: all 0.3s ease;
}

.form-floating-enhanced .form-control:focus ~ label,
.form-floating-enhanced .form-control:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* Enhanced search form animations */
.search-form .form-control {
    transition: all 0.3s ease;
}

.search-form .form-control:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.search-form .btn {
    transition: all 0.3s ease;
}

.search-form .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* AJAX loading states */
.ajax-loading {
    position: relative;
    pointer-events: none;
}

.ajax-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    border-radius: inherit;
}

.ajax-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--bs-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

[data-bs-theme="dark"] .ajax-loading::before {
    background: rgba(33, 37, 41, 0.8);
}

/* Enhanced filter animations */
.filter-slide-in {
    animation: slideInFromTop 0.3s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Enhanced music card hover effects */
.music-card-enhanced {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.music-card-enhanced:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.music-card-enhanced .card-body {
    transition: all 0.3s ease;
}

.music-card-enhanced:hover .card-body {
    padding: 1.5rem;
}

/* Video player error handling styles */
.video-error-container {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.video-error-container:hover {
    border-color: var(--bs-primary);
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
}

.video-error-icon {
    font-size: 3rem;
    color: var(--bs-secondary);
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.video-retry-btn {
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.video-retry-btn:hover {
    transform: translateY(-2px);
}

/* Enhanced keyboard navigation styles */
.keyboard-focus {
    outline: 3px solid var(--bs-warning) !important;
    outline-offset: 2px !important;
    border-radius: var(--border-radius) !important;
}

.presentation-mode *:focus {
    outline: 2px solid var(--bs-warning) !important;
    outline-offset: 2px !important;
}

/* Touch-friendly enhancements for mobile */
@media (max-width: 767px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-tabs .nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
    }
}

/* Progressive enhancement indicators */
.js-enhanced {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.js-enhanced.loaded {
    opacity: 1;
}

/* Print optimizations for presentation mode */
@media print {
    .presentation-mode .music-presentation-container {
        height: auto !important;
        overflow: visible !important;
    }
    
    .presentation-mode .music-lyrics,
    .presentation-mode .music-chords {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        page-break-inside: avoid;
    }
    
    .presentation-mode .nav-tabs {
        display: none !important;
    }
    
    .presentation-mode .tab-content .tab-pane {
        display: block !important;
        opacity: 1 !important;
    }
}