/* =====================================================
   MyAds - Premium White + Red Theme Stylesheet
   Primary: #E53935  |  Secondary: #FF4D4D
   Background: #FFFFFF  |  Cards: #F8F8F8
   Border Radius: 18px  |  Soft Shadow
   ===================================================== */

/* --- CSS Variables --- */
:root {
    --primary: #E53935;
    --primary-dark: #C62828;
    --primary-light: #FF4D4D;
    --primary-r: 229;
    --primary-g: 57;
    --primary-b: 53;
    --primary-bg: rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.08);
    --secondary: #FF4D4D;
    --bg: #FFFFFF;
    --bg-secondary: #F8F8F8;
    --bg-card: #F8F8F8;
    --text: #1a1a2e;
    --border: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 18px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 8px 32px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.12);
    --transition: all 0.3s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 80px;
    overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }

/* --- Container --- */
.container { width: 100%; max-width: 480px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 1200px; }

/* --- Typography --- */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }
.page-title { font-size: 1.5rem; margin-bottom: 20px; color: var(--text); }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border: none; border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 600; cursor: pointer;
    transition: var(--transition); text-decoration: none; line-height: 1;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff; box-shadow: 0 4px 16px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.4); color: #fff; }
.btn-secondary {
    background: var(--bg-secondary); color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-outline {
    background: transparent; color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* --- Form Elements --- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
    width: 100%; padding: 12px 16px; font-size: 0.95rem;
    border: 1.5px solid var(--border); border-radius: 12px;
    background: var(--bg); color: var(--text);
    transition: var(--transition); outline: none;
    font-family: inherit;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-control::placeholder { color: var(--text); }
select.form-control { 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 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* --- Cards --- */
.card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 20px; margin-bottom: 16px;
    box-shadow: var(--shadow); transition: var(--transition);
    border-top: 3px solid var(--primary);
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-header { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-body { }

/* --- Balance Cards --- */
.balance-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; border-radius: var(--radius); padding: 28px 24px;
    margin-bottom: 20px; box-shadow: 0 8px 32px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.25);
}
.balance-card .label { font-size: 0.85rem; opacity: 0.85; margin-bottom: 4px; }
.balance-card .amount { font-size: 2.2rem; font-weight: 800; }
.balance-card .sub { font-size: 0.85rem; opacity: 0.75; margin-top: 4px; }

/* --- Stats Grid --- */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.stat-card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 18px; text-align: center;
    box-shadow: var(--shadow); transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.stat-card .icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px; font-size: 1.2rem;
}
.stat-card .icon.red { background: var(--primary-bg); color: var(--primary); }
.stat-card .icon.green { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-card .icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.stat-card .icon.orange { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-card .stat-value { font-size: 1.3rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.75rem; color: var(--text); margin-top: 2px; }

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-card); border-top: 1px solid var(--border);
    display: flex; justify-content: space-around; align-items: center;
    padding: 6px 0; padding-bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 1000; box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}
.nav-item {
    display: flex; flex-direction: column; align-items: center;
    padding: 8px 12px; border-radius: 12px;
    color: var(--text); font-size: 0.7rem; font-weight: 500;
    transition: var(--transition); cursor: pointer; text-decoration: none; min-width: 56px;
}
.nav-item i, .nav-item svg { font-size: 1.3rem; margin-bottom: 2px; transition: var(--transition); }
.nav-item:hover, .nav-item.active { color: var(--primary); }
.nav-item.active { background: var(--primary-bg); }

/* --- Auth Pages --- */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: linear-gradient(135deg, #fef2f2 0%, #fff 40%, #f8fafc 100%);
}
.auth-box {
    width: 100%; max-width: 420px; background: #fff;
    border-radius: 24px; padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 4px 20px rgba(0, 0, 0, 0.04);
    animation: fadeInUp 0.5s ease both;
    border: 1px solid rgba(0, 0, 0, 0.04);
}
.auth-box .logo { text-align: center; margin-bottom: 28px; }
.auth-box .logo .logo-icon {
    width: 64px; height: 64px; border-radius: 18px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px; color: #fff; box-shadow: 0 8px 24px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.3);
}
.auth-box .logo h1 { font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.auth-box .logo p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.auth-box .auth-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; text-align: center; }
.auth-link { text-align: center; margin-top: 20px; font-size: 0.88rem; color: var(--text-muted); }
.auth-link a { color: var(--primary); font-weight: 600; }
.auth-link a:hover { text-decoration: underline; }

/* Auth input with icon */
.auth-input-group {
    position: relative; margin-bottom: 18px;
}
.auth-input-group .input-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none; transition: color 0.3s ease;
    display: flex; align-items: center;
}
.auth-input-group input {
    width: 100%; padding: 14px 16px 14px 46px; font-size: 0.95rem;
    border: 2px solid var(--border); border-radius: 14px;
    background: var(--bg-secondary); color: var(--text);
    transition: all 0.3s ease; outline: none; font-family: inherit;
}
.auth-input-group input:focus {
    border-color: var(--primary); background: #fff;
    box-shadow: 0 0 0 4px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.1);
}
.auth-input-group input:focus + .input-icon,
.auth-input-group input:focus ~ .input-icon {
    color: var(--primary);
}
.auth-input-group input::placeholder { color: #9ca3af; }

/* Auth submit button */
.auth-submit {
    width: 100%; padding: 15px; font-size: 1rem; font-weight: 700;
    border: none; border-radius: 14px; cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff; box-shadow: 0 6px 20px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.35);
    transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 6px;
}
.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.45);
}
.auth-submit:active { transform: translateY(0); }

/* Auth divider */
.auth-divider {
    display: flex; align-items: center; gap: 12px; margin: 20px 0;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-divider span { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

/* Auth footer link */
.auth-footer {
    text-align: center; margin-top: 20px; padding-top: 18px;
    border-top: 1px solid var(--border); font-size: 0.88rem; color: var(--text-muted);
}
.auth-footer a { color: var(--primary); font-weight: 600; }

/* --- Alerts --- */
.alert {
    padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
    font-size: 0.9rem; font-weight: 500;
}
.alert-success { background: rgba(16, 185, 129, 0.1); color: #065f46; border: 1px solid rgba(16, 185, 129, 0.2); }
.alert-danger { background: rgba(239, 68, 68, 0.1); color: #991b1b; border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: #92400e; border: 1px solid rgba(245, 158, 11, 0.2); }
.alert-info { background: rgba(59, 130, 246, 0.1); color: #1e40af; border: 1px solid rgba(59, 130, 246, 0.2); }

/* --- Ad View Page --- */
.ad-view-page {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 20px; text-align: center;
}
.ad-view-page .countdown-ring { position: relative; width: 160px; height: 160px; margin: 20px auto; }
.ad-view-page .countdown-ring svg { transform: rotate(-90deg); }
.ad-view-page .countdown-ring .bg-circle { fill: none; stroke: var(--border); stroke-width: 6; }
.ad-view-page .countdown-ring .progress-circle {
    fill: none; stroke: var(--primary); stroke-width: 6;
    stroke-linecap: round; stroke-dasharray: 439.8; stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}
.ad-view-page .countdown-number {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 2.5rem; font-weight: 800; color: var(--primary);
}
.ad-view-page .ad-label { color: var(--text); margin-bottom: 8px; }
.ad-view-page .reward-amount { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

/* --- Task Item --- */
.task-item {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 18px; margin-bottom: 12px;
    box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.task-item .task-title { font-size: 1rem; font-weight: 700; }
.task-item .task-desc { font-size: 0.85rem; color: var(--text); }
.task-item .task-reward { color: var(--primary); font-weight: 700; font-size: 0.95rem; }
.task-item .task-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.task-item .task-actions .btn { flex: 1; min-width: 100px; }

/* --- Withdrawal List --- */
.withdraw-item {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 16px; margin-bottom: 10px;
    box-shadow: var(--shadow); display: flex; justify-content: space-between; align-items: center;
}
.withdraw-item .info { flex: 1; }
.withdraw-item .info .title { font-weight: 600; font-size: 0.95rem; }
.withdraw-item .info .meta { font-size: 0.8rem; color: var(--text); margin-top: 2px; }
.withdraw-item .status-badge {
    padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.status-badge.pending { background: rgba(245, 158, 11, 0.1); color: #92400e; }
.status-badge.approved { background: rgba(16, 185, 129, 0.1); color: #065f46; }
.status-badge.rejected { background: rgba(239, 68, 68, 0.1); color: #991b1b; }

/* --- Section Header --- */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; margin-top: 20px;
}
.section-header h3 { font-size: 1.05rem; font-weight: 700; }
.section-header a { font-size: 0.85rem; color: var(--primary); font-weight: 600; }

/* --- Announcement Item --- */
.announcement-item {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 16px; margin-bottom: 10px;
    border-left: 4px solid var(--primary); box-shadow: var(--shadow);
}
.announcement-item .ann-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.announcement-item .ann-text { font-size: 0.85rem; color: var(--text); }
.announcement-item .ann-date { font-size: 0.75rem; color: var(--text); margin-top: 6px; }

/* --- Referral Card --- */
.referral-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; border-radius: var(--radius); padding: 24px;
    text-align: center; margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(var(--primary-r), var(--primary-g), var(--primary-b), 0.25);
}
.referral-card .ref-code {
    background: rgba(255,255,255,0.2); border-radius: 12px;
    padding: 12px; font-size: 1.3rem; font-weight: 800; letter-spacing: 2px;
    margin: 12px 0; word-break: break-all;
}
.referral-card .ref-link {
    background: rgba(255,255,255,0.15); border-radius: 12px;
    padding: 10px 16px; font-size: 0.8rem; word-break: break-all;
    margin-bottom: 12px;
}
.copy-btn {
    background: rgba(255,255,255,0.25); color: #fff;
    border: none; padding: 8px 20px; border-radius: 10px;
    cursor: pointer; font-weight: 600; transition: var(--transition);
}
.copy-btn:hover { background: rgba(255,255,255,0.35); }

/* --- Page Header --- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0; margin-bottom: 8px;
}
.page-header h1 { font-size: 1.4rem; font-weight: 800; }

/* --- Top Bar --- */
.top-bar {
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    padding: 12px 0; position: sticky; top: 0; z-index: 100;
}
.top-bar .container { display: flex; align-items: center; justify-content: space-between; }
.top-bar .site-name { font-weight: 800; font-size: 1.1rem; color: var(--primary); text-decoration: none; }
.top-bar .site-name:hover { color: var(--primary-dark); }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 0.9rem; }

/* --- Loading --- */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner {
    width: 40px; height: 40px; border: 4px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Profile Page --- */
.profile-header {
    text-align: center; padding: 30px 0 20px;
}
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: var(--primary-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700; margin: 0 auto 12px;
}
.profile-name { font-size: 1.3rem; font-weight: 700; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 20px 0; }
.profile-stat { text-align: center; background: var(--bg-card); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }
.profile-stat .val { font-weight: 700; font-size: 1.1rem; }
.profile-stat .lbl { font-size: 0.7rem; color: var(--text); }
.share-btn { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-decoration: none; transition: var(--transition); }
.share-btn.whatsapp { background: #25D366; color: #fff; }
.share-btn.facebook { background: #1877F2; color: #fff; }
.share-btn.twitter { background: #000; color: #fff; }
.share-btn.telegram { background: #0088CC; color: #fff; }
.share-btn:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.2); }

/* --- Responsive --- */
@media (min-width: 768px) {
    .container { max-width: 600px; }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .bottom-nav { max-width: 600px; left: 50%; transform: translateX(-50%); border-radius: 18px 18px 0 0; }
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text); }
.text-primary { color: var(--primary); }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Dashboard Cards */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.dash-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.dash-card {
    border-radius: 16px;
    padding: 20px;
    color: #fff;
    transition: var(--transition);
    animation: fadeInUp 0.4s ease both;
}
.dash-card:nth-child(1) { animation-delay: 0.05s; }
.dash-card:nth-child(2) { animation-delay: 0.1s; }
.dash-card:nth-child(3) { animation-delay: 0.15s; }
.dash-card:nth-child(4) { animation-delay: 0.2s; }
.dash-card:nth-child(5) { animation-delay: 0.25s; }
.dash-card:nth-child(6) { animation-delay: 0.3s; }
.dash-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.dash-label { font-size: 0.85rem; font-weight: 500; opacity: 0.9; margin-bottom: 4px; }
.dash-value { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.dash-blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.dash-green { background: linear-gradient(135deg, #059669, #10b981); }
.dash-cyan { background: linear-gradient(135deg, #0891b2, #22d3ee); }
.dash-yellow { background: linear-gradient(135deg, #d97706, #fbbf24); }
.dash-red { background: linear-gradient(135deg, #dc2626, #f87171); }
.dash-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.dash-gray { background: linear-gradient(135deg, #6b7280, #9ca3af); }
.dash-dark { background: linear-gradient(135deg, #1f2937, #374151); }

/* Section Cards */
.dash-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: fadeInUp 0.4s ease both;
    border-top: 3px solid var(--primary);
}
.dash-section:nth-child(odd) { border-top-color: var(--primary); }
.dash-section:nth-child(even) { border-top-color: #10b981; }
.dash-section-header {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.dash-section-body { padding: 0; }
.dash-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item:hover { background: var(--primary-bg); }
.dash-list-title { font-weight: 600; font-size: 0.9rem; }
.dash-list-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.dash-list-amount { font-weight: 700; color: #10b981; font-size: 0.95rem; }
.dash-list-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* Page Animations */
.page-animate { animation: fadeInUp 0.4s ease both; }
.card-animate { animation: fadeInUp 0.4s ease both; }
.card-animate:nth-child(1) { animation-delay: 0.05s; }
.card-animate:nth-child(2) { animation-delay: 0.1s; }
.card-animate:nth-child(3) { animation-delay: 0.15s; }
.card-animate:nth-child(4) { animation-delay: 0.2s; }
.card-animate:nth-child(5) { animation-delay: 0.25s; }
.card-animate:nth-child(6) { animation-delay: 0.3s; }
@media (max-width: 480px) {
    .dash-cards { grid-template-columns: 1fr; }
    .dash-card { padding: 16px; }
    .dash-value { font-size: 1.3rem; }
}
.gap-10 { gap: 10px; }
.gap-8 { gap: 8px; }
