:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #000000;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --accent: #007bff;
    --accent-hover: #0056b3;
    --chord-color: #0066cc;
    --success: #28a745;
    --danger: #dc3545;
    --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #404040;
    --accent: #4a9eff;
    --accent-hover: #6bb1ff;
    --chord-color: #5fa3ff;
    --success: #4ade80;
    --danger: #f87171;
    --shadow: rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
header {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    padding-bottom: 16px;
}

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

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Buttons */
button, .btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

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

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-icon {
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
}

/* Forms */
input, textarea, select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

textarea {
    resize: vertical;
    font-family: "Courier New", monospace;
    line-height: 1.8;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

/* Song display */
.song-header {
    margin-bottom: 24px;
}

.song-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 8px;
}

.song-artist {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.song-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Transpose controls */
.controls-sticky {
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    margin-bottom: 24px;
    z-index: 100;
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
}

.control-indicator {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
}

.btn-compact {
    padding: 8px 10px !important;
    min-width: 36px;
    font-size: 14px;
}

/* Lyrics display */
.lyrics-container {
    font-family: "Courier New", monospace;
    font-size: 16px;
    line-height: 2.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.lyrics-line {
    position: relative;
    margin-bottom: 8px;
}

.chord {
    color: var(--chord-color);
    font-weight: bold;
    position: absolute;
    top: -1.2em;
    font-size: 14px;
}

.lyrics-line.hide-chords .chord {
    display: none;
}

/* Search */
.search-form {
    margin-bottom: 24px;
}

.search-results {
    list-style: none;
}

.song-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.song-item:hover {
    background-color: var(--bg-secondary);
}

.song-item-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.song-item-artist {
    color: var(--text-secondary);
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 16px;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: 0 4px 20px var(--shadow);
}

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

.modal-title {
    font-size: 20px;
    font-weight: bold;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    min-width: 32px;
    min-height: 32px;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Quick chord buttons */
.chord-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.chord-btn {
    min-width: 60px;
    padding: 10px;
    font-size: 14px;
    font-family: "Courier New", monospace;
    font-weight: bold;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 16px;
}

.hidden {
    display: none;
}

.btn.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Modal/Dialog */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 100%;
    padding: 24px;
    animation: slideUp 0.2s ease;
    position: relative;
    z-index: 100000;
}

.modal-header {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal-body {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1;
    min-width: 100px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Mobile optimizations */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 12px;
    }
    
    .header-content {
        padding: 12px 0;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .card {
        padding: 16px;
    }
    
    h1 {
        font-size: 24px !important;
    }
    
    h2 {
        font-size: 20px !important;
    }
    
    h3 {
        font-size: 18px !important;
    }
    
    .controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .controls .btn {
        flex: 1;
        min-width: calc(50% - 4px);
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .song-title {
        font-size: 24px !important;
    }
    
    .song-artist {
        font-size: 18px !important;
    }
    
    .lyrics-line {
        font-size: 14px;
    }
    
    .chord {
        font-size: 13px;
    }
    
    .modal {
        padding: 20px;
    }
    
    .modal-header {
        font-size: 18px;
    }
    
    .modal-body {
        font-size: 14px;
    }
    
    .modal-actions .btn {
        min-width: 80px;
    }
}

