/* Global Styles - Modern Minimal Design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background: #fafafa;
    min-height: 100vh;
    color: #1a1a1a;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    padding: 40px 60px;
}

/* Header */
header {
    margin-bottom: 48px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e5e5;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #666;
    font-size: 0.95rem;
    font-weight: 400;
}

/* Filters */
.filters {
    display: flex;
    gap: 10px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.filters input,
.filters select,
.filters button {
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s;
}

.filters input {
    flex: 1;
    min-width: 220px;
    background: white;
}

.filters select {
    background: white;
    cursor: pointer;
    min-width: 120px;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: #1a1a1a;
    background: #fafafa;
}

.filters button {
    background: #1a1a1a;
    color: white;
    border: 1px solid #1a1a1a;
    cursor: pointer;
    font-weight: 500;
    padding: 10px 20px;
}

.filters button:hover {
    background: #333;
}

.filters button:active {
    transform: scale(0.98);
}

/* Sheet List */
.sheet-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.sheet-card {
    background: white;
    padding: 20px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    height: 100%;
    /* Ensure card fills the anchor */
}

.sheet-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.sheet-card:hover {
    border-color: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sheet-card h3 {
    color: #1a1a1a;
    margin-bottom: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sheet-card .artist {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 12px;
    font-style: normal;
}

.sheet-info {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #666;
}

.badge.genre {
    background: #1a1a1a;
    color: white;
}

.tags {
    color: #999;
    font-size: 0.85rem;
    margin-top: 8px;
}

.loading,
.error,
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 0.95rem;
}

.error {
    color: #d32f2f;
}

/* Viewer Styles */
.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e5e5;
}

.back-btn {
    padding: 8px 16px;
    background: white;
    color: #1a1a1a;
    text-decoration: none;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: #1a1a1a;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

#transpositionGuide {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fffbeb;
    /* Light yellow for visibility */
    color: #b45309;
    border: 1px solid #fcd34d;
}

.transpose-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.transpose-control label {
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.transpose-control button {
    width: 32px;
    height: 32px;
    border: 1px solid #e0e0e0;
    background: white;
    color: #1a1a1a;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.transpose-control button:hover {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

.transpose-control span {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a1a;
    min-width: 36px;
    text-align: center;
}

.lyric-toggle-btn {
    padding: 10px 18px;
    background: white;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.lyric-toggle-btn:hover {
    background: #fafafa;
    border-color: #1a1a1a;
}

.lyric-toggle-btn.active {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

/* Sheet Viewer */
.sheet-header {
    text-align: center;
    margin-bottom: 24px;
}

.sheet-header h1 {
    font-size: 2rem;
    color: #1a1a1a;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sheet-header .artist {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 16px;
    font-weight: 400;
}

.sheet-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    color: #999;
    font-size: 0.9rem;
}

.sheet-content {
    max-width: 900px;
    margin: 0 auto;
}

.section {
    margin-bottom: 16px;
    /* Reduced from 24px */
}

.section-label {
    font-weight: 600;
    font-size: 1rem;
    color: #1a1a1a;
    margin-bottom: 8px;
    /* Reduced from 16px */
    padding-bottom: 4px;
    /* Reduced from 8px */
    border-bottom: 1px solid #e5e5e5;
    letter-spacing: -0.01em;
}

.measures-container {
    background: white;
}

.measure-line {
    display: flex;
    align-items: stretch;
    margin-bottom: 8px;
    /* Reduced from 12px */
    gap: 4px;
    /* Reduced from 6px */
}

.measure {
    flex: 1;
    min-width: 0;
}

.beats {
    display: flex;
    gap: 8px;
    /* Reduced */
    margin-bottom: 2px;
    /* Reduced */
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;
    font-weight: 600;
    font-size: 1.05rem;
    color: #1a1a1a;
    min-height: 20px;
}

.beat {
    flex: 1;
    text-align: center;
}

.lyrics {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.4;
    /* Slightly tighter */
}

.lyric-line {
    margin-bottom: 2px;
    color: #666;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.measure-separator {
    width: 1px;
    background: #999;
    margin: 0 4px;
    /* Reduced */
    align-self: stretch;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 24px 20px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .filters {
        flex-direction: column;
    }

    .filters input,
    .filters select {
        min-width: 100%;
    }

    .sheet-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .viewer-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .transpose-control {
        width: 100%;
        justify-content: center;
    }

    .beats {
        font-size: 0.9rem;
        gap: 8px;
    }

    .measure-separator {
        font-size: 1.2rem;
    }

    .sheet-header h1 {
        font-size: 1.6rem;
    }

    .sheet-meta {
        flex-direction: column;
        gap: 8px;
    }
}

/* Share Button & Modal */
.header-controls {
    display: flex;
    gap: 16px;
    align-items: center;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.share-btn:hover {
    border-color: #1a1a1a;
    background: #fafafa;
}

.share-btn svg {
    width: 18px;
    height: 18px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.share-item:hover {
    border-color: #1a1a1a;
    background: #fafafa;
}

.share-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
}

.share-icon.facebook {
    background: #1877F2;
}

.share-icon.twitter {
    background: #000;
}

.share-icon.threads {
    background: #000;
}

.share-icon.copy {
    background: #666;
}

.share-icon.pwa {
    background: #10b981;
}

.share-item span {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

@media (max-width: 500px) {
    .share-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-controls {
        flex-wrap: wrap;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .container {
        padding: 20px;
    }

    .viewer-header,
    .back-btn {
        display: none;
    }

    .sheet-content {
        max-width: 100%;
    }
}

/* AdBlock Detection Modal */
.adblock-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.adblock-content {
    background: white;
    border-radius: 16px;
    max-width: 450px;
    width: 90%;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.adblock-header {
    text-align: center;
    margin-bottom: 24px;
}

.adblock-header h3 {
    font-size: 1.3rem;
    color: #1a1a1a;
    font-weight: 600;
    margin-top: 12px;
}

.adblock-body {
    text-align: center;
    color: #666;
    line-height: 1.6;
    margin-bottom: 28px;
}

.adblock-body p {
    margin: 0;
}

.adblock-body strong {
    color: #1a1a1a;
}

.adblock-footer {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

.adblock-btn-primary,
.adblock-btn-secondary {
    padding: 14px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    border: none;
    font-family: inherit;
}

.adblock-btn-primary {
    background: #1a1a1a;
    color: white;
}

.adblock-btn-primary:hover {
    background: #333;
    transform: translateY(-1px);
}

.adblock-btn-secondary {
    background: white;
    color: #666;
    border: 1px solid #e0e0e0;
}

.adblock-btn-secondary:hover {
    background: #fafafa;
    border-color: #ccc;
}