/* Modern BGG Game Tracker Theme */

:root {
    --primary: #FF6600;
    --primary-hover: #E65C00;
    --secondary: #6366f1;
    --success: #10b981;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --bg-page: #f9fafb;
    --bg-card: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Progress Steps */
.progress-container {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.progress-bar {
    max-width: 640px;
    margin: 0 auto 16px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    width: 25%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.steps {
    display: flex;
    justify-content: space-between;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 12px;
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 0.7;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.step.active .step-number {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(255, 102, 0, 0.1);
}

.step.completed .step-number {
    background: var(--success);
    color: white;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

/* Main Container */
.container {
    flex: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 20px;
    width: 100%;
}

/* Header */
.header {
    margin-bottom: 32px;
}

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

.header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Wizard Form */
.wizard-form {
    position: relative;
}

.form-step {
    display: none;
    animation: fadeIn 0.3s ease;
}

.form-step.active {
    display: block;
}

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

/* Card */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.card .description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 24px;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input[type="search"],
.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group select[multiple] {
    min-height: 120px;
    background-image: none;
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

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

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

.btn-outline {
    background: var(--bg-card);
    color: var(--primary);
    border: 1px solid var(--primary);
    flex: 1;
}

.btn-outline:hover {
    background: rgba(255, 102, 0, 0.05);
}

.btn .icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* Step Actions */
.step-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.step-actions .btn {
    flex: 1;
}

/* Photo Preview */
.photo-preview {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-page);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.photo-preview img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 12px;
}

.btn-clear {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-clear .icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.checkbox-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.checkbox-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-card:hover {
    border-color: var(--primary);
    background: rgba(255, 102, 0, 0.02);
}

.checkbox-card input:checked ~ .checkbox-label {
    color: var(--primary);
    font-weight: 600;
}

.checkbox-card input:checked ~ .check-icon {
    opacity: 1;
}

.checkbox-card input:checked + .checkbox-label {
    color: var(--primary);
}

.checkbox-card {
    border-color: var(--border);
}

.checkbox-card:has(input:checked) {
    border-color: var(--primary);
    background: rgba(255, 102, 0, 0.05);
}

.checkbox-label {
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.check-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    stroke-width: 3;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Remove Player Button */
.btn-remove-player {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-player:hover {
    background: #fee;
    border-color: #f55;
    color: #f55;
}

.btn-remove-player svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.checkbox-card:hover .btn-remove-player {
    opacity: 1;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.divider span {
    padding: 0 16px;
}

/* Add Player Button */
.btn-add {
    width: 100%;
}

/* Slider (Range Input) */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--primary) 0%, var(--primary) 50%, var(--border) 50%, var(--border) 100%);
    outline: none;
    margin: 12px 0;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    box-shadow: var(--shadow-lg), 0 0 0 6px rgba(255, 102, 0, 0.1);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    box-shadow: var(--shadow-lg), 0 0 0 6px rgba(255, 102, 0, 0.1);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Time Group */
.time-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Review Section */
.review-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.review-item:last-child {
    border-bottom: none;
}

.review-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    min-width: 100px;
}

.review-value {
    text-align: right;
    color: var(--text-primary);
    font-size: 0.9375rem;
    flex: 1;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: var(--bg-page);
    color: var(--text-primary);
}

.btn-close svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* QR Scanner */
#qrVideo {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    background: #000;
}

.scan-hint {
    margin-top: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Success Modal */
.success-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.success-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    animation: slideUp 0.3s ease;
}

.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon svg {
    width: 36px;
    height: 36px;
    stroke-width: 3;
    color: var(--success);
}

.success-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.success-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 20px;
    text-align: center;
    margin-top: auto;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 640px) {
    .step-label {
        display: none;
    }

    .card {
        padding: 20px;
    }

    .checkbox-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .time-group {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 20px 16px;
    }

    .header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .steps {
        padding: 0 12px;
        gap: 8px;
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading State */
.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Game Search Results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 4px;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(255, 102, 0, 0.05);
}

.search-result-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.search-result-year {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
