/* Cards */
.card {
    background: var(--color-surface);
    padding: 20px;
    margin: 0 auto;
    max-width: 500px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.card h2 {
    color: var(--color-primary);
    text-align: center;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    text-align: center;
}

.btn--primary {
    background-color: var(--color-primary);
    color: white;
}

.btn--primary:hover {
    background-color: var(--color-primary-active);
    text-decoration: none;
    color: white;
}

.btn--secondary {
    background-color: #6c757d;
    color: white;
}

.btn--secondary:hover {
    background-color: #5a6268;
    text-decoration: none;
    color: white;
}

.btn--outline {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

/* Form elements */
form {
    display: flex;
    flex-direction: column;
}

label {
    margin-top: 10px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="search"],
select,
textarea {
    padding: 10px;
    margin-top: 5px;
    border: 1px solid #aaa;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
}

input[type="submit"],
button[type="submit"] {
    margin-top: 20px;
    padding: 10px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 600;
    letter-spacing: 0.5px;
}

input[type="submit"]:hover,
button[type="submit"]:hover {
    background-color: var(--color-primary-active);
}

.login-links p {
    margin: 8px 0;
    font-size: 0.9em;
}

.login-links a {
    color: var(--color-primary);
    text-decoration: none;
}

.login-links a:hover {
    text-decoration: underline;
}

/* Token section (Settings) */
.token-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.token-section h3 {
    color: var(--color-primary);
    margin-bottom: 8px;
}

.token-section p.help-text {
    font-size: 0.9em;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.token-field {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 5px;
}

.token-field input {
    flex: 1;
    padding: 10px;
    border: 1px solid #aaa;
    border-radius: var(--radius-sm);
    background-color: var(--color-input-bg);
}

.token-btn {
    padding: 8px 12px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.85em;
    white-space: nowrap;
}

.token-btn:hover {
    background-color: var(--color-primary-active);
}

.token-btn.secondary {
    background-color: #6c757d;
}

.token-btn.secondary:hover {
    background-color: #5a6268;
}

.copy-feedback {
    font-size: 0.85em;
    color: var(--color-primary);
    margin-left: 4px;
    visibility: hidden;
}

.copy-feedback.visible {
    visibility: visible;
}

/* Dashboard toggles */
.toggle-buttons {
    display: flex !important;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    position: relative;
    z-index: 100;
}

.toggle-buttons button {
    display: inline-block;
    background: var(--color-primary-light);
    color: white;
    padding: 8px 14px;
    border-radius: 5px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-family);
}

.toggle-buttons button.active {
    background: var(--color-primary);
}

.toggle-buttons button:hover {
    background: var(--color-primary-hover);
}

.loader {
    display: none;
    text-align: center;
    padding: 20px;
}

/* Docs / Help prose */
.docs-content {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.docs-content h1 {
    margin-bottom: 20px;
    color: var(--color-text);
}

.docs-content h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--color-primary-light);
}

.docs-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--color-text);
    font-size: 1.05em;
}

.docs-content p {
    line-height: 1.6;
    color: var(--color-text-muted);
    margin-bottom: 15px;
}

.docs-content ul,
.docs-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
    color: var(--color-text-muted);
    line-height: 1.8;
}

.docs-content a {
    color: var(--color-primary-light);
    text-decoration: underline;
}

.docs-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

.docs-content pre {
    background: #f5f5f5;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    overflow-x: auto;
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 15px;
}

.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.docs-content th,
.docs-content td {
    border: 1px solid var(--color-border);
    padding: 10px 12px;
    text-align: left;
    color: var(--color-text-muted);
}

.docs-content th {
    background: #f9f9f9;
    font-weight: 600;
}

/* Search users */
.search-input {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    border-radius: 6px;
    border: 1px solid #ccc;
    margin-bottom: 20px;
}

.no-results {
    text-align: center;
    color: #888;
    margin-top: 20px;
}

/* Add score form */
.score-form-card {
    background: var(--color-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    max-width: 600px;
    box-shadow: var(--shadow-card);
}

.score-form-card label {
    display: block;
    margin-top: 15px;
}

.score-form-card input,
.score-form-card textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
}

.score-form-card button {
    margin-top: 20px;
    padding: 10px 15px;
    background: var(--color-primary-light);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: var(--font-family);
}

.score-form-card button:hover {
    background: var(--color-primary-hover);
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.score-table th,
.score-table td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.95em;
}

.score-table th {
    background: var(--color-primary-light);
    color: white;
}

.score-table tr:hover {
    background: #f1f1f1;
}

.no-scores {
    background: var(--color-surface);
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    color: #777;
}

select.updating {
    opacity: 0.6;
    transition: opacity 0.2s;
}

#results-container {
    transition: opacity 0.2s;
}

/* Score compare */
.compare-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 10px;
    border-radius: var(--radius-md);
}

.compare-row .score {
    width: 45%;
    padding: 10px;
    border-radius: var(--radius-md);
    text-align: center;
}

.compare-row .song-name {
    font-weight: bold;
}

.score-card--compare-win {
    background: #c3f7c3;
    border-left: 6px solid green;
}

.score-card--compare-lose {
    background: #f7c3c3;
    border-left: 6px solid red;
}

.score-card--compare-tie {
    background: #f7f7c3;
    border-left: 6px solid gold;
}

/* Compare page (compare.php) */
.compare-page-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 18px;
}

.compare-page-card h2,
.compare-page-card h3 {
    margin-top: 0;
}

.compare-muted {
    color: var(--color-text-subtle);
    font-size: 0.9rem;
}

.compare-winner-left {
    background: linear-gradient(90deg, #e6f7ff, #fff);
}

.compare-winner-right {
    background: linear-gradient(90deg, #fff, #e9ffe6);
}

.compare-tie-row {
    background: #fffde6;
}

.compare-required {
    color: #c62828;
}

.compare-filters-panel {
    margin-top: 12px;
}

.compare-user-search {
    width: 100%;
    max-width: 280px;
}

.compare-user-suggestions {
    position: absolute;
    z-index: 20;
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #ddd);
    border-radius: var(--radius-md, 6px);
    box-shadow: var(--shadow-card, 0 2px 8px rgba(0, 0, 0, 0.12));
    max-height: 200px;
    overflow-y: auto;
    min-width: 200px;
}

.scores-filter-cell {
    position: relative;
}

.compare-user-suggestion {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.compare-user-suggestion:hover,
.compare-user-suggestion:focus {
    background: var(--color-surface-muted, #f5f5f5);
}

.compare-user-suggestion--empty {
    color: var(--color-text-subtle, #666);
    cursor: default;
}

.compare-summary-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin: 12px 0 16px;
    padding: 12px 14px;
    background: var(--color-surface-muted, #f8f9fa);
    border-radius: var(--radius-md, 6px);
    font-size: 0.95rem;
}

.compare-summary-item--user1 {
    color: #1565c0;
}

.compare-summary-item--user2 {
    color: #2e7d32;
}

.compare-summary-item--ties {
    color: var(--color-text-subtle, #666);
}

.compare-col-user {
    text-align: center;
}

.compare-score-cell {
    text-align: center;
}

.user-search-results .user-search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border, #eee);
}

.user-search-results .compare-links {
    flex-shrink: 0;
    font-size: 0.9rem;
}

.user-search-results .compare-links a {
    margin-left: 10px;
    white-space: nowrap;
}

.user-search-results .compare-links a:first-child {
    margin-left: 0;
}

.message--info {
    color: #1565c0;
    margin-bottom: 6px;
}

.banned-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--header-height) + 20px) 20px 20px;
}

.banned-box {
    max-width: 700px;
    width: 100%;
    background: linear-gradient(to bottom, #ffffff, #f2f2f2);
    border: 1px solid var(--color-border-light);
    padding: 36px;
    border-radius: 10px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.banned-box h1 {
    margin: 0 0 10px;
    color: #c62828;
    font-size: 1.8rem;
}

.banned-box p {
    color: #444;
    margin: 12px 0;
    line-height: 1.5;
}

.banned-meta {
    margin-top: 18px;
    color: var(--color-text-subtle);
    font-size: 0.95rem;
}

.banned-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.banned-support {
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--color-text-subtle);
}

/* Tab buttons (admin) */
.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-buttons button {
    background: #ddd;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    font-family: var(--font-family);
}

.tab-buttons button.active {
    background: var(--color-primary-light);
    color: white;
}

.tab-buttons button:hover {
    background: #bbb;
}

.tab-buttons button.active:hover {
    background: var(--color-primary-hover);
}

#content-area {
    background: var(--color-surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin: 30px auto;
    min-height: auto;
}

#content-area h3 {
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
}

#content-area form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#content-area input,
#content-area textarea {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-family: var(--font-family);
    width: 100%;
    box-sizing: border-box;
}

#content-area button {
    background-color: var(--color-primary-light);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    font-family: var(--font-family);
}

#content-area button:hover {
    background-color: var(--color-primary-hover);
}

#content-area iframe {
    width: 100%;
    height: 80vh;
    border: none;
}

/* Score history page */
.score-history-header {
    margin-bottom: var(--space-md);
}

.score-history-header h2 {
    margin: 0 0 var(--space-xs);
}

.score-history-summary {
    color: var(--color-text-muted);
    font-size: 0.95em;
    margin: var(--space-xs) 0 0;
}

.score-history-summary-grade {
    font-weight: 600;
}

.score-history-scroll-hint {
    display: none;
    color: var(--color-text-muted);
    font-size: 0.85em;
    margin: var(--space-md) 0 var(--space-xs);
    text-align: center;
}

.score-history-scroll {
    overflow-x: visible;
    margin-top: var(--space-md);
}

.score-history-table {
    min-width: 0;
    table-layout: auto;
}

.score-history-table th,
.score-history-table td {
    text-align: center;
    white-space: nowrap;
}

.score-history-table thead th {
    position: static;
    z-index: auto;
    text-align: left;
    padding: 10px 15px;
    font-size: 0.95em;
    font-weight: 600;
    background: var(--color-primary-light);
    color: white;
    border: none;
    border-bottom: 1px solid var(--color-border-light);
}

.score-history-table tbody td {
    padding: 8px 10px;
    font-size: 0.9em;
    border: 1px solid var(--color-border);
}

/* Grade backgrounds on sticky Date/Grade cells override tr:hover; apply hover to all cells */
.score-history-table.score-table tbody tr:hover > td {
    background: #f1f1f1;
    color: var(--color-text);
}

@media (max-width: 768px) {
    .score-history-scroll-hint {
        display: block;
    }

    .score-history-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .score-history-table {
        min-width: 720px;
    }

    .score-history-table thead th,
    .score-history-table tbody td {
        padding: 6px 8px;
        font-size: 0.85em;
    }

    .score-history-table thead th:first-child,
    .score-history-table tbody td.score-history-col--sticky:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
    }

    .score-history-table thead th:nth-child(2),
    .score-history-table tbody td.score-history-col--sticky:nth-child(2) {
        position: sticky;
        left: var(--score-history-date-col-width, 7.5rem);
        z-index: 2;
    }

    .score-history-table thead th:first-child,
    .score-history-table thead th:nth-child(2) {
        z-index: 3;
        background: var(--color-primary-light);
    }
}

.score-history-row--pb {
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.score-history-table .delete-score-button {
    background: none;
    border: none;
    color: #c62828;
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    padding: 4px;
}

.score-history-table .delete-score-button:hover:not(:disabled) {
    opacity: 0.8;
}

.score-history-table .delete-score-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.score-history-empty-action {
    text-align: center;
    margin-top: var(--space-sm);
}
