/* Alt-Tab - Music Tab App Styles */

:root {
    --bg-primary: #f7f7f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eeeeee;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --chord-color: #dc2626;
    --chord-bg: #fef2f2;
    --border: #dddddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    min-height: 100vh;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0.75rem;
}

/* Header */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo:hover {
    color: var(--accent);
}

.nav {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

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

.btn-outline:hover {
    background: var(--bg-tertiary);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.125rem;
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* Search */
.search-bar {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    outline: none;
    transition: border-color 0.15s ease;
}

.search-input:focus {
    border-color: var(--accent);
}

/* Filter/Sort Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.filter-bar select {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    cursor: pointer;
}

/* Song List */
.song-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.song-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
    box-shadow: var(--shadow);
}

.song-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

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

.song-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.song-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.song-key {
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 500;
}

.song-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.tag {
    background: var(--accent);
    color: white;
    padding: 0.0625rem 0.375rem;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 500;
}

/* Song Display Page */
.song-header {
    text-align: center;
    padding: 1rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.song-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.125rem;
}

.song-header .artist {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.song-details {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8125rem;
}

.song-details span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.song-details .label {
    color: var(--text-muted);
}

.song-details .value {
    font-weight: 600;
}

/* Tab Content */
.tab-content {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    line-height: 1.35;
    padding: 0.75rem;
    background: var(--bg-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    min-height: 50vh;
}

.tab-content .chord {
    color: var(--chord-color);
    font-weight: 700;
    background: var(--chord-bg);
    padding: 0 0.25rem;
    border-radius: 3px;
    display: inline-block;
    margin: 0 0.0625rem;
}

/* Action Bar (fixed bottom on song page) */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    gap: 0.375rem;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}

.action-bar .btn {
    flex: 1;
    max-width: 100px;
}

/* Forms */
.form-group {
    margin-bottom: 0.875rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.9375rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    outline: none;
    transition: border-color 0.15s ease;
}

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

.form-textarea {
    font-family: var(--font-mono);
    min-height: 250px;
    resize: vertical;
    line-height: 1.4;
}

.form-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Import Page */
.import-preview {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-top: 0.75rem;
}

.import-preview h3 {
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
}

.import-preview pre {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
}

/* Messages */
.message {
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.message-success {
    background: #dcfce7;
    color: #166534;
}

.message-error {
    background: #fee2e2;
    color: #991b1b;
}

.message-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

/* Utility */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.375rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 640px) {
    html {
        font-size: 15px;
    }
    
    .header-content {
        flex-wrap: wrap;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .song-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .song-meta {
        width: 100%;
        justify-content: space-between;
    }
    
    .action-bar {
        padding: 0.375rem;
        gap: 0.25rem;
    }
    
    .action-bar .btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .tab-content {
        font-size: 0.875rem;
        padding: 0.625rem;
        padding-bottom: 4rem;
    }
}

/* Print styles for PDF */
@media print {
    .header,
    .action-bar,
    .btn {
        display: none !important;
    }
    
    .tab-content {
        padding: 0;
        font-size: 12pt;
    }
    
    .song-header {
        padding: 1rem 0;
    }
}
