/* ============================================
   WASEEJ - User Profile Page
   ============================================ */

:root {
    --color-primary: #c8875a;
    --color-primary-light: #daa06d;
    --color-primary-dark: #a66d3e;
    --color-primary-glow: rgba(200, 135, 90, 0.3);
    --color-bg-dark: #0a0a0c;
    --color-bg-card: #13131a;
    --color-bg-card-alt: #16161f;
    --color-text-primary: #f5f0eb;
    --color-text-secondary: #a8a3b3;
    --color-text-muted: #6b6678;
    --color-border: rgba(255, 255, 255, 0.07);
    --color-success: #4ade80;
    --color-error: #f87171;
    --font-display: 'Inter', sans-serif;
    --font-body: 'Tajawal', 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }

body {
    font-family: var(--font-body);
    background: var(--color-bg-dark);
    color: var(--color-text-primary);
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font-family: inherit; color: inherit; }
input { border: none; background: none; font-family: inherit; color: inherit; outline: none; }

/* ---- Loading ---- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.4s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(200, 135, 90, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ---- Background ---- */
.profile-wrapper {
    position: relative;
    min-height: 100vh;
}

.bg-animation {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.1;
}

.bg-circle-1 {
    width: 500px;
    height: 500px;
    background: var(--color-primary);
    top: -200px;
    right: -100px;
    animation: floatBg 20s ease-in-out infinite;
}

.bg-circle-2 {
    width: 400px;
    height: 400px;
    background: #4a3728;
    bottom: -150px;
    left: -100px;
    animation: floatBg 25s ease-in-out infinite reverse;
}

@keyframes floatBg {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-40px, 30px); }
}

/* ---- Top Bar ---- */
.profile-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(10, 10, 12, 0.85);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--color-border);
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    transition: all var(--transition-base);
}

.back-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-text-primary);
    background: rgba(200, 135, 90, 0.08);
}

.topbar-logo .logo-img {
    height: 28px;
    width: auto;
    filter: drop-shadow(0 0 8px var(--color-primary-glow));
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--color-error);
    font-size: 0.85rem;
    border-radius: var(--radius-full);
    transition: all var(--transition-base);
}

.logout-btn:hover {
    background: rgba(248, 113, 113, 0.1);
}

/* ---- Profile Content ---- */
.profile-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* ---- User Header ---- */
.user-header-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    margin-bottom: 1.5rem;
    animation: slideUp 0.5s ease-out both;
}

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

.user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 25px var(--color-primary-glow);
}

.user-name {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.user-email {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    direction: ltr;
    text-align: right;
}

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    overflow: hidden;
    animation: slideUp 0.5s ease-out both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-credits .stat-icon {
    background: rgba(200, 135, 90, 0.15);
    color: var(--color-primary-light);
}

.stat-views .stat-icon {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.stat-time .stat-icon {
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
}

.stat-date .stat-icon {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

.stat-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: var(--font-display);
}

/* Credits glow */
.stat-credits .stat-glow {
    position: absolute;
    top: -30px;
    right: -30px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-primary);
    opacity: 0.06;
    filter: blur(20px);
}

/* ---- Recharge Section ---- */
.recharge-section {
    margin-bottom: 2rem;
    animation: slideUp 0.5s ease-out both;
    animation-delay: 0.25s;
}

.section-header {
    margin-bottom: 1rem;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.section-header h2 i {
    color: var(--color-primary);
    font-size: 1rem;
}

.section-header p {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

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

.recharge-form {
    display: flex;
    gap: 0.75rem;
}

.recharge-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.recharge-input-group:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.recharge-input-group i {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.recharge-input-group input {
    flex: 1;
    padding: 0.85rem 0;
    font-size: 1rem;
    font-family: var(--font-display);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.recharge-input-group input::placeholder {
    color: var(--color-text-muted);
    letter-spacing: 0;
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.recharge-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.recharge-btn:hover {
    background: var(--color-primary-light);
    box-shadow: 0 0 25px var(--color-primary-glow);
    transform: translateY(-1px);
}

.recharge-btn.loading span,
.recharge-btn.loading i {
    opacity: 0;
}

.recharge-btn.loading {
    position: relative;
}

.recharge-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Recharge Messages */
.recharge-msg {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-top: 1rem;
}

.recharge-msg.show { display: flex; }

.recharge-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--color-error);
    animation: shake 0.4s ease;
}

.recharge-success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.2);
    color: var(--color-success);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ---- Quick Actions ---- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    animation: slideUp 0.5s ease-out both;
    animation-delay: 0.3s;
}

.action-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    transition: all var(--transition-base);
}

.action-card i {
    font-size: 1rem;
    color: var(--color-primary);
}

.action-card:hover {
    border-color: var(--color-primary);
    color: var(--color-text-primary);
    background: rgba(200, 135, 90, 0.06);
    transform: translateY(-2px);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .profile-topbar {
        padding: 0.75rem 1rem;
    }

    .back-btn span,
    .logout-btn span {
        display: none;
    }

    .profile-content {
        padding: 1.25rem 1rem 3rem;
    }

    .user-header-card {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }

    .user-email {
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .recharge-form {
        flex-direction: column;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }
}
