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

.btn:hover {
    text-decoration: none;
}

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

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

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

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

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

.btn-success:hover {
    background-color: var(--color-success-dark);
}

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

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    width: 18px;
    height: 18px;
}

.btn-odds {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-left: 0.25rem;
}

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-light);
}

.form-input-readonly {
    background-color: var(--color-bg-secondary);
    cursor: not-allowed;
}

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

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

.form-error {
    background-color: var(--color-danger-light);
    border: 1px solid var(--color-danger);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    color: var(--color-danger);
    font-size: 0.875rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Cards */
.card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 1rem 0;
}

/* Auth Pages */
.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 0 1.5rem;
}

.auth-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 0.5rem 0;
}

.auth-subtitle {
    color: var(--color-text-secondary);
    margin: 0;
}

.auth-form {
    margin-bottom: 1.5rem;
}

.auth-info {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.auth-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-icon.success {
    background-color: var(--color-success-light);
    color: var(--color-success);
}

.auth-icon svg {
    width: 32px;
    height: 32px;
}

.auth-footer {
    text-align: center;
}

.auth-note {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* Dev Login Section */
.dev-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.dev-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    margin: 0 0 1rem 0;
    text-align: center;
}

.dev-note {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: center;
    margin: 1rem 0 0 0;
}

.dev-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.dev-action-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dev-action-create {
    background-color: var(--color-success-light);
    color: var(--color-success);
    border-color: var(--color-success);
}

.dev-action-create:hover {
    background-color: var(--color-success);
    color: white;
}

.dev-action-delete {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.dev-action-delete:hover {
    background-color: var(--color-danger);
    color: white;
}

.dev-category {
    margin-bottom: 1rem;
}

.dev-category-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin: 0 0 0.5rem 0;
}

.dev-users {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dev-user-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.75rem;
    min-width: 80px;
    background-color: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.15s ease;
}

.dev-user-btn:hover {
    background-color: var(--color-bg-tertiary);
    border-color: var(--color-accent);
    text-decoration: none;
}

.dev-user-btn.superuser {
    border-color: var(--color-danger);
    background-color: var(--color-danger-light);
}

.dev-user-btn.superuser:hover {
    background-color: var(--color-danger);
}

.dev-user-btn.superuser:hover .dev-user-name,
.dev-user-btn.superuser:hover .dev-user-desc {
    color: white;
}

.dev-user-btn.staff {
    border-color: var(--color-warning);
    background-color: var(--color-warning-light);
}

.dev-user-btn.staff:hover {
    background-color: var(--color-warning);
}

.dev-user-btn.staff:hover .dev-user-name,
.dev-user-btn.staff:hover .dev-user-desc {
    color: white;
}

.dev-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.dev-user-desc {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invitation-message {
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-style: italic;
    color: var(--color-text-secondary);
}

/* Profile */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.profile-card,
.settings-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.profile-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.profile-email {
    color: var(--color-text-secondary);
    margin: 0.25rem 0;
}

.profile-joined {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.stat-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Avatar Picker */
.avatar-picker {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.5rem;
}

.avatar-option {
    cursor: pointer;
}

.avatar-option img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 0.15s ease;
}

.avatar-option.selected img,
.avatar-option:hover img {
    border-color: var(--color-accent);
}

/* Invitations */
.invite-form-card,
.invitations-list-card,
.invite-limit-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.invite-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.invitations-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.invitation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius);
}

.invitation-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.invitation-email {
    font-weight: 500;
}

.invitation-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.status-pending {
    background-color: var(--color-warning-light);
    color: var(--color-warning);
}

.status-accepted {
    background-color: var(--color-success-light);
    color: var(--color-success);
}

.status-expired,
.status-revoked {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

.invitation-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Filters */
.filters-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    background-color: var(--color-bg-secondary);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all 0.15s ease;
}

.filter-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.filter-btn:hover {
    background-color: var(--color-bg-tertiary);
    text-decoration: none;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 1rem;
}

.modal-content {
    background-color: var(--color-bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-sm {
    max-width: 400px;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

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

.modal-form,
.modal-body {
    padding: 1.5rem;
}

.modal-text {
    color: var(--color-text-secondary);
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Resolve Options */
.resolve-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.resolve-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.resolve-label {
    flex: 1;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    border: 2px solid var(--color-border);
    transition: all 0.15s ease;
}

.resolve-option input:checked + .resolve-label.for {
    border-color: var(--color-success);
    background-color: var(--color-success-light);
}

.resolve-option input:checked + .resolve-label.against {
    border-color: var(--color-danger);
    background-color: var(--color-danger-light);
}

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

.empty-state-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
}

/* Leaderboard */
.leaderboard-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.leaderboard-table {
    width: 100%;
}

.leaderboard-header,
.leaderboard-row {
    display: grid;
    grid-template-columns: 60px 1fr 100px 100px 80px 80px;
    gap: 1rem;
    align-items: center;
    padding: 0.875rem 1.5rem;
}

.leaderboard-header {
    background-color: var(--color-bg-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.leaderboard-row {
    border-top: 1px solid var(--color-border);
}

.leaderboard-row.current-user {
    background-color: var(--color-accent-light);
}

.rank-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
}

.rank-medal.gold {
    background: linear-gradient(135deg, #ffd700, #ffec8b);
    color: #8b6914;
}

.rank-medal.silver {
    background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
    color: #555;
}

.rank-medal.bronze {
    background: linear-gradient(135deg, #cd7f32, #daa06d);
    color: #5c3d1e;
}

.rank-number {
    color: var(--color-text-muted);
    font-weight: 500;
}

.col-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.you-badge {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background-color: var(--color-accent);
    color: white;
    border-radius: var(--radius-sm);
}

.col-points.positive {
    color: var(--color-success);
}

.col-points.negative {
    color: var(--color-danger);
}

.streak-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    background-color: var(--color-warning-light);
    color: var(--color-warning);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* Form Card */
.form-card {
    max-width: 600px;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
}

.form-errors {
    background-color: var(--color-danger-light);
    border: 1px solid var(--color-danger);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.form-errors .error {
    color: var(--color-danger);
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
}

.form-errors .error:last-child {
    margin-bottom: 0;
}

.inline-form {
    display: inline;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.toggle-switch-label {
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--color-bg-tertiary);
    border-radius: 12px;
    transition: background-color 0.2s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-slider.active {
    background-color: var(--color-accent);
}

.toggle-slider.active::after {
    transform: translateX(20px);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .profile-layout {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 50px 1fr 80px;
    }

    .col-winrate,
    .col-streak,
    .col-bets {
        display: none;
    }

    .avatar-picker {
        grid-template-columns: repeat(5, 1fr);
    }
}
