/* ============================================
   Bad Games - Components CSS
   Buttons, Forms, Cards, Flash, Toast, Modals
   ============================================ */

/* ===========================================
   Buttons
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    min-height: 44px;
}

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

.btn:active {
    transform: scale(0.98);
}

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

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

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

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

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

.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #000;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
    min-height: 36px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.copy-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* ===========================================
   Forms
   =========================================== */
.form-group {
    margin-bottom: 20px;
}

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

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

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

input::placeholder {
    color: var(--text-muted);
}

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

.input-with-button {
    display: flex;
    gap: 10px;
}

.input-with-button input {
    flex: 1;
}

.input-with-button .btn {
    flex-shrink: 0;
}

.settings-form {
    max-width: 400px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.radio-label:has(input:checked) {
    border-color: var(--accent);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-label span {
    font-weight: 500;
}

.radio-label small {
    color: var(--text-secondary);
}

/* ===========================================
   Cards
   =========================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* ===========================================
   Flash Messages
   =========================================== */
.flash-messages {
    padding: 0 20px;
    margin-bottom: 16px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.flash {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    background: var(--bg-card);
    border-left: 4px solid var(--accent);
}

.flash-success { border-left-color: var(--success); }
.flash-error { border-left-color: var(--error); }
.flash-warning { border-left-color: var(--warning); }
.flash-info { border-left-color: var(--accent); }

/* ===========================================
   Toast Notifications
   =========================================== */
.toast {
    position: fixed;
    bottom: calc(20px + var(--safe-area-bottom));
    left: 20px;
    right: 20px;
    max-width: 400px;
    margin: 0 auto;
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--accent);
    box-shadow: var(--shadow);
    animation: slideUp 0.3s ease;
    z-index: 1000;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }

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

/* ===========================================
   Modal
   =========================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 20px;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

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

/* Confirm Modal */
.modal-confirm {
    text-align: center;
    max-width: 380px;
}

.modal-confirm h3 {
    margin-bottom: 8px;
}

.modal-confirm p {
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.5;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    line-height: 1;
}

/* ===========================================
   Empty & Loading States
   =========================================== */
.empty-state {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.loading-state {
    text-align: center;
    padding: 24px 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===========================================
   Utility Classes
   =========================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden { display: none !important; }

/* ===========================================
   Responsive
   =========================================== */
@media (max-width: 480px) {
    .card {
        padding: 24px 20px;
    }
}
