/**
 * Lute Tablatures Search Engine - Custom Styles
 * Brand colors from cuerdaspulsadas.com
 */

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&family=Quicksand:wght@700&display=swap');

:root {
    --color-primary: #50870f;
    --color-primary-dark: #3d6a0b;
    --color-primary-light: #6ba323;
    --color-secondary: #000000;
    --color-dark: #111111;
    --color-dark-alt: #222222;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-light: #f5f5f5;
    --color-white: #ffffff;
    --color-alert: #b20000;
    --color-success: #627D47;
    --border-radius: 5px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Base Styles */
body {
    font-family: 'Open Sans', sans-serif;
    font-weight: 400;
    color: var(--color-text);
    background-color: var(--color-light);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Open Sans', sans-serif;
    font-weight: 300;
    color: var(--color-dark);
}

/* DataTables Customization */
.dataTables_wrapper {
    font-size: 14px;
    overflow-x: auto;
    width: 100%;
}

table.dataTable {
    width: 100% !important;
}

table.dataTable th,
table.dataTable td {
    white-space: normal;
    word-wrap: break-word;
}

table.dataTable th {
    min-width: 60px;
}

table.dataTable {
    table-layout: fixed;
}

/* Scrollbar styling */
.dataTables_scrollBody::-webkit-scrollbar {
    height: 8px;
}

.dataTables_scrollBody::-webkit-scrollbar-track {
    background: var(--color-light);
    border-radius: 4px;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 4px;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-dark);
}

/* Table responsive wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table.dataTable thead th {
    background-color: var(--color-dark);
    color: var(--color-white);
    font-weight: 600;
    padding: 12px 10px;
    border-bottom: 3px solid var(--color-primary);
}

/* Zebra striping - override DataTables sorting column styles */
table.dataTable tbody tr:nth-child(odd) td,
table.dataTable tbody tr:nth-child(odd) td.sorting_1,
table.dataTable tbody tr:nth-child(odd) td.sorting_2,
table.dataTable tbody tr:nth-child(odd) td.sorting_3 {
    background-color: #ffffff !important;
}

table.dataTable tbody tr:nth-child(even) td,
table.dataTable tbody tr:nth-child(even) td.sorting_1,
table.dataTable tbody tr:nth-child(even) td.sorting_2,
table.dataTable tbody tr:nth-child(even) td.sorting_3 {
    background-color: #f9f9f9 !important;
}

table.dataTable tbody tr {
    cursor: pointer;
}

table.dataTable tbody tr:hover td,
table.dataTable tbody tr:hover td.sorting_1,
table.dataTable tbody tr:hover td.sorting_2,
table.dataTable tbody tr:hover td.sorting_3 {
    background-color: rgba(80, 135, 15, 0.08) !important;
}

table.dataTable tbody tr.shown td,
table.dataTable tbody tr.shown td.sorting_1,
table.dataTable tbody tr.shown td.sorting_2,
table.dataTable tbody tr.shown td.sorting_3 {
    background-color: rgba(80, 135, 15, 0.12) !important;
}

/* Expand button */
td.details-control {
    cursor: pointer;
    text-align: center;
}

.expand-btn {
    color: var(--color-primary);
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}

tr.shown .expand-btn {
    color: var(--color-primary-dark);
}

/* Row details (expanded) */
.row-details {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: linear-gradient(to bottom, rgba(80, 135, 15, 0.05), rgba(80, 135, 15, 0.02));
    border-left: 3px solid var(--color-primary);
}

.row-details-image {
    flex-shrink: 0;
    max-width: 200px;
}

.row-details-image img {
    max-width: 100%;
    max-height: 300px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.row-details-content {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.row-details-section {
    min-width: 200px;
    flex: 1;
}

.row-details-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--color-primary-light);
}

.row-details-section dl {
    margin: 0;
    font-size: 13px;
}

.row-details-section dt {
    font-weight: 600;
    color: var(--color-text);
    float: left;
    clear: left;
    width: 100px;
    margin-bottom: 4px;
}

.row-details-section dd {
    margin-left: 110px;
    margin-bottom: 4px;
    color: var(--color-text-light);
}

table.dataTable tbody td {
    padding: 10px;
    vertical-align: middle;
    border-bottom: 1px solid #e0e0e0;
}

table.dataTable tbody tr:nth-child(odd) {
    background-color: var(--color-white);
}

table.dataTable tbody tr:nth-child(even) {
    background-color: #fafafa;
}

/* SearchBuilder Styling */
.dtsb-searchBuilder {
    padding: 10px 0;
}

/* Hide SearchBuilder's built-in Clear All button (we have our own) */
.dtsb-clearAll {
    display: none !important;
}

.dtsb-group {
    background-color: var(--color-white);
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.dtsb-criteria {
    background-color: var(--color-light);
    border-radius: var(--border-radius);
    padding: 8px;
    margin: 5px 0;
}

.dtsb-button {
    background-color: var(--color-primary) !important;
    color: var(--color-white) !important;
    border: none !important;
    border-radius: var(--border-radius) !important;
    padding: 8px 16px !important;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
}

.dtsb-button:hover {
    background-color: var(--color-primary-dark) !important;
}

/* View Tabs */
.view-tabs-container {
    display: flex;
    gap: 10px;
    background: var(--color-white);
    padding: 10px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.view-tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: var(--color-light);
    color: var(--color-text);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.view-tab:hover {
    background: rgba(80, 135, 15, 0.1);
    border-color: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.view-tab.active {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(80, 135, 15, 0.3);
}

.view-tab-icon {
    font-size: 20px;
    line-height: 1;
}

.view-tab-label {
    line-height: 1;
}

@media (max-width: 600px) {
    .view-tabs-container {
        flex-direction: column;
        gap: 8px;
    }

    .view-tab {
        justify-content: center;
        padding: 12px 20px;
    }
}

/* Intro Hero Section */
.intro-hero {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-white);
    padding: 35px 40px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-hover);
}

.intro-hero h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--color-white);
}

.intro-hero p {
    font-size: 18px;
    margin: 0;
    opacity: 0.95;
}

.intro-hero strong {
    font-weight: 700;
}

/* Filter Section Title */
.filter-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-light);
    margin: 0 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 600px) {
    .intro-hero {
        padding: 25px 20px;
    }

    .intro-hero h2 {
        font-size: 24px;
    }

    .intro-hero p {
        font-size: 15px;
    }
}

/* Guide View */
.guide-container {
    max-width: 1200px;
    margin: 0 auto;
}

.guide-hero {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--color-white);
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 30px;
    box-shadow: var(--shadow-hover);
}

.guide-hero h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 15px 0;
    color: var(--color-white);
}

.guide-hero p {
    font-size: 18px;
    margin: 0;
    opacity: 0.95;
}

.guide-hero a {
    color: var(--color-white);
    text-decoration: underline;
}

.guide-hero strong {
    font-weight: 700;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.guide-card {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--color-primary);
}

.guide-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.guide-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-card li {
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
    line-height: 1.5;
}

.guide-card li:last-child {
    border-bottom: none;
}

.guide-card li strong {
    color: var(--color-primary-dark);
}

.guide-credits {
    background: var(--color-light);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--color-text-light);
}

.guide-credits p {
    margin: 5px 0;
}

.guide-credits a {
    color: var(--color-primary);
    text-decoration: none;
}

.guide-credits a:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .guide-hero {
        padding: 25px;
    }

    .guide-hero h2 {
        font-size: 22px;
    }

    .guide-hero p {
        font-size: 15px;
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }
}

/* Download Links */
.download-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 26px;
    border-radius: var(--border-radius);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    text-transform: uppercase;
}

.download-link.pdf {
    background-color: #c0392b;
    color: var(--color-white);
}

.download-link.pdf:hover {
    background-color: #a93226;
}

.download-link.midi {
    background-color: #2980b9;
    color: var(--color-white);
}

.download-link.midi:hover {
    background-color: #1f6692;
}

.download-link.ft3 {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.download-link.ft3:hover {
    background-color: var(--color-primary-dark);
}

.download-link.fac {
    background-color: #8e44ad;
    color: var(--color-white);
}

.download-link.fac:hover {
    background-color: #713798;
}

/* Difficulty Stars */
.difficulty-stars {
    color: var(--color-primary);
    font-size: 12px;
    letter-spacing: 1px;
}

/* Cards & Sections */
.card, .bg-white {
    background-color: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
}

/* Word Cloud Tooltip */
.wordcloud-tooltip {
    position: absolute;
    display: none;
    background: #1f2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

/* Timeline Layout - main content + side panel */
.timeline-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.timeline-scroll-container {
    flex: 1;
    min-width: 0;
    background: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-height: 800px;
    overflow-y: auto;
}

/* Vertical Timeline */
.timeline-vertical {
    position: relative;
    padding: 20px 20px 20px 60px;
}

.timeline-vertical::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(to bottom, var(--color-primary-light), var(--color-primary), var(--color-primary-dark));
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(80, 135, 15, 0.3);
}

/* Year Section */
.timeline-year {
    position: relative;
    margin-bottom: 40px;
}

.timeline-year:last-child {
    margin-bottom: 0;
}

.timeline-year-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    position: relative;
}

.timeline-year-marker {
    position: absolute;
    left: -38px;
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    border-radius: 50%;
    border: 4px solid var(--color-white);
    box-shadow: 0 3px 10px rgba(80, 135, 15, 0.4), 0 0 0 3px var(--color-primary-light);
}

.timeline-year-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin: 0;
    text-shadow: 1px 1px 0 rgba(80, 135, 15, 0.1);
}

.timeline-year-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-white);
    background: var(--color-primary);
    padding: 4px 14px;
    border-radius: 15px;
    box-shadow: 0 2px 4px rgba(80, 135, 15, 0.3);
}

/* Timeline Cards Grid */
.timeline-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

/* Individual Card */
.timeline-card {
    background: var(--color-light);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid #e5e5e5;
    transition: all 0.2s;
}

.timeline-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--color-primary-light);
    transform: translateY(-2px);
}

.timeline-card-image {
    height: 120px;
    overflow: hidden;
    background: #ddd;
}

.timeline-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline-card-content {
    padding: 12px;
}

.timeline-card-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-dark);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline-card-composer {
    font-size: 12px;
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 6px;
}

.timeline-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 10px;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

.timeline-card-meta span {
    background: var(--color-white);
    padding: 2px 6px;
    border-radius: 3px;
}

.timeline-card-downloads {
    display: flex;
    gap: 4px;
}

.timeline-card-downloads .download-link {
    width: 28px;
    height: 22px;
    font-size: 9px;
}

/* "More" Card */
.timeline-more-card {
    background: var(--color-primary);
    border-radius: var(--border-radius);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.timeline-more-card:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.timeline-more-content {
    text-align: center;
    color: var(--color-white);
}

.timeline-more-count {
    display: block;
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.timeline-more-text {
    display: block;
    font-size: 14px;
    margin-top: 4px;
}

.timeline-more-cta {
    display: block;
    font-size: 11px;
    margin-top: 8px;
    opacity: 0.8;
    text-decoration: underline;
}

/* Timeline Right Panel */
.timeline-panel {
    width: 380px;
    flex-shrink: 0;
    background: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    border: 2px solid var(--color-primary);
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.timeline-panel.hidden {
    display: none;
}

.timeline-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    border-bottom: 2px solid var(--color-primary);
    background: var(--color-light);
}

.timeline-panel-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color-dark);
}

#timeline-panel-close {
    background: var(--color-dark);
    color: var(--color-white);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s;
}

#timeline-panel-close:hover {
    background: var(--color-primary);
}

.timeline-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.timeline-pieces-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timeline-piece-card {
    background: var(--color-light);
    border-radius: var(--border-radius);
    padding: 12px;
    border-left: 3px solid var(--color-primary);
}

.timeline-piece-card:hover {
    background: rgba(80, 135, 15, 0.08);
}

.timeline-piece-title {
    font-weight: 600;
    color: var(--color-dark);
    font-size: 14px;
    margin-bottom: 4px;
}

.timeline-piece-composer {
    color: var(--color-primary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.timeline-piece-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

.timeline-piece-meta span {
    background: var(--color-white);
    padding: 2px 6px;
    border-radius: 3px;
}

.timeline-piece-downloads {
    display: flex;
    gap: 6px;
}

/* Responsive timeline */
@media (max-width: 1024px) {
    .timeline-layout {
        flex-direction: column;
    }

    .timeline-panel {
        width: 100%;
        max-height: 400px;
        order: -1;
    }

    .timeline-cards {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 600px) {
    .timeline-cards {
        grid-template-columns: 1fr 1fr;
    }

    .timeline-card-image {
        height: 80px;
    }

    .timeline-year-title {
        font-size: 20px;
    }

    .timeline-year-count {
        font-size: 12px;
        padding: 3px 10px;
    }

    .timeline-vertical {
        padding-left: 45px;
    }

    .timeline-vertical::before {
        left: 20px;
        width: 4px;
    }

    .timeline-year-marker {
        left: -30px;
        width: 22px;
        height: 22px;
    }
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    padding: 40px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-message {
    color: var(--color-dark);
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: 300;
}

.loading-progress-bar {
    width: 300px;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 10px;
}

.loading-progress-fill {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.loading-progress-text {
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 600;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Banner */
.error-banner {
    background-color: #fef2f2;
    border: 1px solid var(--color-alert);
    color: var(--color-alert);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

/* Responsive adjustments */

/* Hide columns on tablet (< 1024px) */
@media (max-width: 1024px) {
    .hidden-tablet {
        display: none !important;
    }
}

/* Hide columns on mobile (< 768px) */
@media (max-width: 768px) {
    .hidden-mobile {
        display: none !important;
    }

    .view-tab {
        padding: 12px 16px;
        font-size: 14px;
    }

    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 8px 6px;
        font-size: 13px;
    }

    .download-link {
        width: 28px;
        height: 24px;
        font-size: 9px;
    }

    .loading-progress-bar {
        width: 250px;
    }

    /* Stack header on mobile */
    header .flex {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    header h1 {
        font-size: 1.25rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    table.dataTable thead th,
    table.dataTable tbody td {
        padding: 6px 4px;
        font-size: 12px;
    }

    .download-link {
        width: 24px;
        height: 22px;
        font-size: 8px;
    }

    .download-links {
        gap: 4px;
    }
}

/* Toolbar row */
.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
}

/* External buttons container */
#buttons-container {
    display: inline-flex;
}

#buttons-container .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 0;
}

/* DataTables buttons */
.dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.dt-button {
    background-color: var(--color-dark) !important;
    color: var(--color-white) !important;
    border: none !important;
    border-radius: var(--border-radius) !important;
    padding: 8px 16px !important;
    margin-right: 5px !important;
    font-size: 13px !important;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
}

.dt-button:hover {
    background-color: var(--color-primary) !important;
}

/* Column visibility button */
.btn-colvis {
    background-color: var(--color-primary) !important;
}

/* Column visibility dropdown */
.dt-button-collection {
    background-color: var(--color-white);
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    padding: 8px 0;
}

.dt-button-collection .dt-button {
    background-color: transparent !important;
    color: var(--color-text) !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 8px 16px !important;
    margin: 0 !important;
    width: 100%;
    text-align: left;
    font-family: 'Open Sans', sans-serif !important;
    font-weight: 400 !important;
}

.dt-button-collection .dt-button:hover {
    background-color: var(--color-light) !important;
    color: var(--color-primary) !important;
}

.dt-button-collection .dt-button.active {
    background-color: rgba(80, 135, 15, 0.1) !important;
    color: var(--color-primary) !important;
}

.dt-button-collection .dt-button.active::before {
    content: '✓ ';
    color: var(--color-primary);
}

.dt-button-collection .dt-button span {
    display: inline;
}

/* Pagination styling */
.dataTables_paginate .paginate_button {
    border-radius: var(--border-radius) !important;
    margin: 0 2px !important;
}

.dataTables_paginate .paginate_button.current {
    background: var(--color-primary) !important;
    color: var(--color-white) !important;
    border: none !important;
}

.dataTables_paginate .paginate_button:hover {
    background: var(--color-primary-light) !important;
    color: var(--color-white) !important;
    border: none !important;
}

/* Info and length styling */
.dataTables_info {
    color: var(--color-text-light);
    font-size: 13px;
}

.dataTables_length select {
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 5px 10px;
}

/* Custom header styling */
.site-header {
    background-color: var(--color-dark);
    border-bottom: 3px solid var(--color-primary);
}

.site-header a {
    color: var(--color-primary);
    transition: color 0.2s;
}

.site-header a:hover {
    color: var(--color-primary-light);
}

/* Custom footer styling */
.site-footer {
    background-color: var(--color-dark);
    border-top: 3px solid var(--color-primary);
}

.site-footer a {
    color: var(--color-primary);
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--color-primary-light);
}

/* Section headers */
.section-title {
    font-weight: 300;
    color: var(--color-dark);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Buttons */
.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.btn-secondary {
    background-color: var(--color-dark);
    color: var(--color-white);
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: var(--color-primary);
}

/* Clear filters button */
#clear-filters {
    background-color: var(--color-light);
    color: var(--color-text);
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    padding: 8px 16px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

#clear-filters:hover {
    background-color: var(--color-dark);
    color: var(--color-white);
    border-color: var(--color-dark);
}

/* ==================== */
/* Library View Styles  */
/* ==================== */

/* Filter tabs */
.library-filter-btn {
    background-color: var(--color-light);
    color: var(--color-text);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 8px 16px;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.library-filter-btn:hover {
    background: rgba(80, 135, 15, 0.1);
    border-color: var(--color-primary-light);
}

.library-filter-btn.active {
    background-color: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary-dark);
}

/* Book grid */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}

/* Book card */
.library-book {
    background: var(--color-white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.library-book:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-primary-light);
}

.library-book-cover {
    height: 200px;
    background: linear-gradient(135deg, #e8e0d5 0%, #d4c8b8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.library-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Placeholder cover (no image) */
.library-book-cover.placeholder {
    padding: 15px;
    text-align: center;
}

.library-book-cover.placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c4b8a8' fill-opacity='0.3'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.library-book-cover.placeholder .placeholder-title {
    position: relative;
    z-index: 1;
    font-family: 'Georgia', serif;
    font-size: 13px;
    color: #5c4c3a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.library-book-info {
    padding: 12px;
    background: var(--color-light);
}

.library-book-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-dark);
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.library-book-count {
    font-size: 12px;
    color: var(--color-primary);
    font-weight: 600;
}

/* Library Modal */
.library-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.library-modal.hidden {
    display: none;
}

.library-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.library-modal-content {
    position: relative;
    background: var(--color-white);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.library-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--color-dark);
    color: var(--color-white);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 1;
}

.library-modal-close:hover {
    background: var(--color-primary);
}

.library-modal-body {
    display: flex;
    gap: 25px;
    padding: 25px;
}

.library-modal-cover {
    flex-shrink: 0;
    width: 200px;
}

.library-modal-cover img {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.library-modal-info {
    flex: 1;
    min-width: 0;
}

.library-modal-info h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-dark);
    margin: 0 0 15px 0;
    padding-right: 30px;
}

.library-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.library-modal-meta span {
    background: var(--color-light);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-size: 13px;
    color: var(--color-text);
}

.library-modal-meta span::before {
    margin-right: 5px;
}

.library-modal-piece-list {
    margin-bottom: 20px;
}

.library-modal-piece-list h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.library-modal-piece-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

.library-modal-piece-list li {
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    color: var(--color-text);
}

.library-modal-piece-list li:last-child {
    border-bottom: none;
}

.library-modal-piece-list .more-pieces {
    color: var(--color-primary);
    font-weight: 600;
    font-style: italic;
}

.library-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.library-modal-actions .btn-primary,
.library-modal-actions .btn-secondary {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Responsive library */
@media (max-width: 768px) {
    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    .library-book-cover {
        height: 170px;
    }

    .library-modal-body {
        flex-direction: column;
        padding: 20px;
    }

    .library-modal-cover {
        width: 100%;
        max-width: 200px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .library-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .library-book-cover {
        height: 150px;
    }

    .library-book-info {
        padding: 10px;
    }

    .library-book-title {
        font-size: 12px;
    }
}

/* ==================== */
/* MIDI Player Bar      */
/* ==================== */

.midi-player {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(calc(100% + 20px));
    width: calc(100% - 32px);
    max-width: 1280px;
    height: 60px;
    background: #111111;
    border: 2px solid #50870f;
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 1000;
    transition: transform 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.midi-player.visible {
    transform: translateX(-50%) translateY(0);
}

.midi-player-icon {
    color: #50870f;
    flex-shrink: 0;
}

.midi-player-play {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #50870f;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.midi-player-play:hover {
    background: #6ba323;
    transform: scale(1.05);
}

.midi-player-play .pause-icon {
    display: none;
}

.midi-player.playing .midi-player-play .play-icon {
    display: none;
}

.midi-player.playing .midi-player-play .pause-icon {
    display: inline;
}

.midi-player.playing .midi-player-play {
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(80, 135, 15, 0.5); }
    50% { box-shadow: 0 0 20px rgba(80, 135, 15, 0.8); }
}

.midi-player-time,
.midi-player-duration {
    color: #ffffff;
    font-size: 12px;
    font-family: monospace;
    min-width: 40px;
    flex-shrink: 0;
}

.midi-player-progress {
    flex: 1;
    height: 6px;
    background: #333333;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    min-width: 100px;
}

.midi-player-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3d6a0b, #50870f);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
}

.midi-player-progress:hover .midi-player-progress-bar {
    background: linear-gradient(90deg, #50870f, #6ba323);
}


.midi-player-title {
    color: #ffffff;
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    max-width: 200px;
    flex-shrink: 1;
}

.midi-player-title .title-text {
    display: inline-block;
}

.midi-player-title.overflow .title-text {
    animation: marquee 10s linear infinite;
}

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

.midi-player-download {
    height: 34px;
    padding: 0 14px;
    border-radius: 4px;
    background: #50870f;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.midi-player-download:hover {
    background: #6ba323;
    transform: scale(1.02);
}

.midi-player-close {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: transparent;
    border: 1px solid #444444;
    color: #999999;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.midi-player-close:hover {
    background: #333333;
    border-color: #666666;
    color: #ffffff;
}

/* Loading state */
.midi-player.loading .midi-player-play {
    pointer-events: none;
    opacity: 0.5;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .midi-player {
        height: 50px;
        padding: 0 10px;
        gap: 8px;
    }

    .midi-player-title {
        display: none;
    }

    .midi-player-download {
        padding: 0 10px;
        font-size: 12px;
    }

    .midi-player-download .download-text {
        display: none;
    }

    .midi-player-play {
        width: 36px;
        height: 36px;
    }
}

