/**
 * Profile Page Styles
 */

/* ===================== */
/* PAGE LAYOUT           */
/* ===================== */
.profile-page {
    min-height: calc(100vh - 200px);
    padding: 40px 20px 60px;
}

.profile-container {
    max-width: 900px;
    margin: 0 auto;
}

/* ===================== */
/* LOADING / AUTH STATES */
/* ===================== */
#profile-loading,
#profile-auth-required {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--btc-orange, #f7931a);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.auth-required-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 16px;
    padding: 48px;
    text-align: center;
}

.auth-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.auth-required-card h2 {
    margin: 0 0 12px;
    font-size: 24px;
}

.auth-required-card p {
    color: var(--text-secondary, #888);
    margin: 0 0 24px;
}

/* ===================== */
/* SECTIONS              */
/* ===================== */
.profile-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h1 {
    margin: 0;
    font-size: 28px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 20px;
    color: var(--text-primary, #fff);
}

/* ===================== */
/* OVERVIEW GRID         */
/* ===================== */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.overview-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 20px;
}

.balance-card {
    border-color: rgba(247, 147, 26, 0.3);
    background: linear-gradient(135deg, rgba(247, 147, 26, 0.1), rgba(247, 147, 26, 0.02));
}

.card-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    margin-bottom: 8px;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #fff);
}

.balance-value {
    color: var(--btc-orange, #f7931a);
}

.card-value.positive {
    color: #22c55e;
}

.card-value.negative {
    color: #ef4444;
}

/* ===================== */
/* AUTH METHODS          */
/* ===================== */
.auth-methods-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .auth-methods-grid {
        grid-template-columns: 1fr;
    }
}

.auth-method-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.auth-method-icon {
    font-size: 32px;
}

.auth-method-info {
    flex: 1;
}

.auth-method-info h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.auth-status {
    font-size: 0.85rem;
    margin: 0;
}

.status-active {
    color: #22c55e;
}

.status-pending {
    color: #f59e0b;
}

.status-inactive {
    color: var(--text-secondary, #888);
}

.auth-email {
    font-size: 0.8rem;
    color: var(--text-secondary, #888);
    margin: 4px 0 0;
    word-break: break-all;
}

.wallet-bonus-hint,
.email-bonus-hint {
    font-size: 0.8rem;
    color: var(--btc-orange, #f7931a);
    margin: 4px 0 0;
}

/* ===================== */
/* BUTTONS               */
/* ===================== */
.btn-primary {
    background: linear-gradient(135deg, var(--btc-orange, #f7931a), #ffc107);
    color: #000;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(247, 147, 26, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary, #2a2a2a);
    color: var(--text-primary, #fff);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: var(--bg-quaternary, #333);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* ===================== */
/* HISTORY TABLE         */
/* ===================== */
.history-container {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 12px;
    overflow: hidden;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 14px 16px;
    text-align: left;
}

.history-table th {
    background: var(--bg-tertiary, #2a2a2a);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-table tbody tr {
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.05));
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.text-right {
    text-align: right;
}

.date-cell {
    font-size: 0.9rem;
    color: var(--text-secondary, #888);
}

.description-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.amount-cell {
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.amount-cell.positive {
    color: #22c55e;
}

.amount-cell.negative {
    color: #ef4444;
}

.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.type-deposit {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.type-withdrawal {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.type-spin {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.type-bonus {
    background: rgba(247, 147, 26, 0.15);
    color: #f7931a;
}

.type-other {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.loading-row td {
    text-align: center;
    color: var(--text-secondary, #888);
    padding: 40px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary, #888);
}

.history-pagination {
    padding: 16px;
    text-align: center;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.05));
}

/* ===================== */
/* STATS GRID            */
/* ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.stat-positive {
    color: #22c55e;
}

/* ===================== */
/* MERGE SECTION         */
/* ===================== */
.merge-section {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 12px;
    padding: 24px;
}

.merge-description {
    color: var(--text-secondary, #888);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.merge-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.merge-input-group .form-input {
    flex: 1;
    font-family: 'SF Mono', monospace;
    letter-spacing: 0.5px;
}

.merge-hint {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    margin-top: 16px;
}

.merge-preview {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-primary, #111);
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255,255,255,0.05));
}

.merge-preview-card h4 {
    margin: 0 0 16px 0;
    color: var(--text-primary, #fff);
}

.merge-preview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

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

.merge-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.merge-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
}

.merge-confirm-hint {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    margin-top: 12px;
    text-align: center;
}

.merge-error {
    color: #ef4444;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    margin: 0;
}

.merge-success {
    text-align: center;
    padding: 20px;
}

.merge-success-icon {
    width: 48px;
    height: 48px;
    background: #22c55e;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 16px;
}

.merge-success h4 {
    margin: 0 0 8px 0;
    color: #22c55e;
}

.merge-success p {
    margin: 4px 0;
    color: var(--text-secondary, #888);
}

.loading-spinner.small {
    width: 24px;
    height: 24px;
    margin: 10px auto;
}

/* ===================== */
/* MERGE HISTORY         */
/* ===================== */
.merge-history-section {
    margin-top: 20px;
}

.merge-history-section .section-title {
    font-size: 16px;
    color: var(--text-secondary, #888);
    margin-bottom: 12px;
}

.merge-history-list {
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 8px;
    padding: 12px 16px;
}

.merge-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
}

.merge-history-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.05));
}

.merge-history-icon {
    font-size: 14px;
    opacity: 0.6;
}

.merge-history-text {
    flex: 1;
}

/* ===================== */
/* MODALS                */
/* ===================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    z-index: 1001;
}

.modal.open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 24px;
}

.warning-text {
    color: #f59e0b;
    font-size: 0.9rem;
    margin: 0 0 16px;
}

.recovery-code-display {
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 16px;
    font-family: monospace;
    font-size: 14px;
    word-break: break-all;
    margin-bottom: 16px;
    user-select: all;
}

.form-group {
    margin-bottom: 16px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 8px;
    color: var(--text-primary, #fff);
    font-size: 16px;
}

.form-input:focus {
    outline: none;
    border-color: var(--btc-orange, #f7931a);
}

.form-error {
    display: block;
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 8px;
}

.hint-text {
    font-size: 0.85rem;
    color: var(--text-secondary, #888);
    margin-top: 16px;
    text-align: center;
}

.wallet-bonus-banner {
    background: linear-gradient(135deg, rgba(247, 147, 26, 0.15), rgba(247, 147, 26, 0.05));
    border: 1px solid rgba(247, 147, 26, 0.3);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.bonus-icon {
    font-size: 20px;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.qr-code {
    border-radius: 8px;
    margin-bottom: 12px;
}

.lnurl-text {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    word-break: break-all;
    text-align: center;
}

.error-text {
    color: #ef4444;
}

/* ===================== */
/* TOAST NOTIFICATIONS   */
/* ===================== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary, #1a1a1a);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 0.9rem;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    border-color: rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), var(--bg-secondary, #1a1a1a));
}

.toast-error {
    border-color: rgba(239, 68, 68, 0.3);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), var(--bg-secondary, #1a1a1a));
}

/* ===================== */
/* FREE SPIN STATUS      */
/* ===================== */
.free-spin-status-card {
    min-height: 80px;
}

.free-spin-status-card .loading-spinner {
    margin: 20px auto;
}

.free-spin-status-card .loading-spinner.small {
    width: 24px;
    height: 24px;
}

.status-claimed,
.status-pending,
.status-not-claimed,
.status-error {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border-radius: 12px;
}

.status-claimed {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-pending {
    background: linear-gradient(135deg, rgba(247, 147, 26, 0.15), rgba(247, 147, 26, 0.05));
    border: 1px solid rgba(247, 147, 26, 0.3);
}

.status-not-claimed {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-error {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    justify-content: center;
}

.status-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.status-claimed .status-icon {
    color: #22c55e;
}

.status-pending .status-icon {
    color: #f7931a;
}

.status-not-claimed .status-icon {
    color: #3b82f6;
}

.status-content {
    flex: 1;
}

.status-content h3 {
    margin: 0 0 6px 0;
    font-size: 1.1rem;
    color: #fff;
}

.status-content p {
    margin: 0 0 12px 0;
    color: #aaa;
    font-size: 0.95rem;
}

.status-content .btn-small {
    padding: 8px 18px;
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .status-claimed,
    .status-pending,
    .status-not-claimed {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}

/* ===================== */
/* RESPONSIVE            */
/* ===================== */
@media (max-width: 600px) {
    .profile-page {
        padding: 20px 16px 40px;
    }

    .section-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .history-table th,
    .history-table td {
        padding: 12px 10px;
        font-size: 0.85rem;
    }

    .description-cell {
        max-width: 120px;
    }
}
