/* ==========================================================
   SurfAds Theme v1.0 — Modern White Purple Dashboard UI
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #6C4DFF;
    --secondary: #8B5CF6;
    --light-purple: #A78BFA;
    --accent: #7C3AED;
    --bg: #F7F8FC;
    --card: #FFFFFF;
    --text: #1E1B4B;
    --gray-text: #6B7280;
    --border: #E5E7EB;
    --radius-lg: 22px;
    --radius-md: 20px;
    --radius-sm: 14px;
    --shadow-card: 0 10px 35px rgba(108, 77, 255, .12);
    --transition: 0.3s ease;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    color: var(--text);
    background: var(--bg);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(167, 139, 250, .10) 0%, transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(108, 77, 255, .10) 0%, transparent 45%);
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

h1, h2, h3, h4 { font-weight: 700; margin: 0; }

/* Dot pattern decoration, left & right of viewport */
body::before, body::after {
    content: '';
    position: fixed;
    top: 0;
    width: 160px;
    height: 100%;
    background-image: radial-gradient(circle, var(--light-purple) 1px, transparent 1.5px);
    background-size: 18px 18px;
    opacity: .18;
    pointer-events: none;
    z-index: 0;
}
body::before { left: 0; mask-image: linear-gradient(to right, black, transparent); }
body::after  { right: 0; mask-image: linear-gradient(to left, black, transparent); }

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 35px 20px;
    position: relative;
    z-index: 1;
}

/* ---------------- Main Card ---------------- */
.main-card {
    width: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 30px;
    position: relative;
    overflow: hidden;
    animation: fadeIn .5s ease both;
}

.main-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--border), var(--secondary));
}

.refresh-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all var(--transition);
}
.refresh-btn:hover {
    background: var(--bg);
    border-color: var(--light-purple);
    transform: rotate(90deg);
}

.account-id-badge {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--gray-text);
    font-size: 12.5px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 999px;
    z-index: 2;
}

@media (max-width: 640px) {
    .refresh-btn { top: 14px; right: 14px; width: 32px; height: 32px; }
    .refresh-btn svg { width: 15px; height: 15px; }
    .account-id-badge { top: 14px; left: 14px; font-size: 11px; padding: 6px 11px; }
}

/* ---------------- Balance Card ---------------- */
.balance-card {
    text-align: center;
    padding: 25px 20px 30px;
    position: relative;
}

.balance-card .label {
    color: var(--gray-text);
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    font-size: 13px;
}

.balance-card .value {
    font-size: 56px;
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: glowPulse 3s ease-in-out infinite;
}

.balance-card .sub {
    color: var(--text);
    font-weight: 600;
    font-size: 15px;
    margin-top: 4px;
}

/* ---------------- Menu Pills ---------------- */
.menu-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 25px 0 30px;
}

.menu-pills a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.menu-pills a svg, .menu-pills a i { color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #DC2626;
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
}
.menu-pills a.active .nav-badge, .menu-pills a:hover .nav-badge { background: #fff; color: #DC2626; }

.admin-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 480px) {
    .admin-grid-2 { grid-template-columns: 1fr; }
}

.menu-pills a:hover {
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 7px 13px;
    transform: translateY(-2px);
}
.menu-pills a:hover svg, .menu-pills a:hover i { color: var(--primary); }

.menu-pills a.active {
    background: var(--card);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 7px 13px; /* 1px less to offset the thicker border, keeps the pill the same size */
}
.menu-pills a.active svg, .menu-pills a.active i { color: var(--primary); }

/* ---------------- Ads Grid ---------------- */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 25px;
}
.ad-card-more { display: none; }

.ad-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 6px 20px rgba(108, 77, 255, .08);
    padding: 24px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    animation: slideUp .5s ease both;
}

.ad-card::before {
    content: '';
    position: absolute;
    top: 0; left: 20px; right: 20px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.ad-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 18px 40px rgba(108, 77, 255, .22);
    border-color: var(--light-purple);
}

.ad-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 26px;
    margin-bottom: 14px;
}

.ad-card .site-name { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.ad-card .site-desc { color: var(--gray-text); font-size: 15px; line-height: 1.5; margin-bottom: 16px; }

.ad-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.ad-card-timer {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--gray-text);
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 999px;
    flex-shrink: 0;
}

.ad-reward-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, rgba(108,77,255,.10), rgba(139,92,246,.10));
    border: 1px solid var(--light-purple);
    color: var(--accent);
    font-size: 13.5px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 999px;
}

/* Ad banner slots (728x90 / 300x250 / 468x60) — shared by ptc/view.php,
   faucet.php, and anywhere else that embeds one of these ad codes. */
.ad-banner {
    border: 1px solid var(--border);
    background: #fff;
    overflow: hidden;
    line-height: 0;
}
.ad-banner-728 { width: 728px; max-width: 100%; height: 90px; margin: 0 auto 16px; }
.ad-banner-468 { width: 468px; max-width: calc(100vw - 20px); height: 60px; }
.ad-banner-300 { width: 300px; max-width: 100%; height: 250px; margin: 0 auto; }

/* Mobile: the 728x90 and 468x60 formats don't fit well on a phone screen */
@media (max-width: 640px) {
    .ad-banner-728, .ad-banner-468 { display: none; }
}

.dash-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 480px;
    margin: 0 auto 24px;
}

@media (max-width: 480px) {
    .dash-stats-grid { grid-template-columns: 1fr; }
}

.history-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 18px;
    margin-bottom: 36px;
}

@media (max-width: 1100px) {
    .history-stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .history-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (max-width: 400px) {
    .history-stats-grid { grid-template-columns: 1fr; }
}

.btn-view-ad {
    width: 100%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 600;
    font-size: 13.5px;
    padding: 9px 0;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--transition), box-shadow var(--transition);
}
.btn-view-ad:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(108, 77, 255, .4);
}

/* ---------------- Generic buttons / forms ---------------- */
.btn-primary {
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}
.btn-primary:hover { transform: scale(1.03); box-shadow: 0 10px 25px rgba(108, 77, 255, .35); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.form-control {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 15px;
    background: #fff;
    color: var(--text);
    transition: border-color var(--transition);
}
.form-control:focus { outline: none; border-color: var(--primary); }
label.form-label { font-weight: 600; font-size: 14px; margin-bottom: 6px; display: block; color: var(--text); }

/* ---------------- Home page ---------------- */
.home-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-size: 44px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 15px 40px rgba(108, 77, 255, .35);
    animation: glowPulse 3s ease-in-out infinite;
}
.home-title {
    font-size: 42px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 10px;
}
.home-tagline { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.home-desc { color: var(--gray-text); font-size: 15px; max-width: 460px; margin: 0 auto 26px; line-height: 1.6; }

.home-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.home-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.home-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.home-logo-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.home-brand-name { font-weight: 700; font-size: 15px; color: var(--text); }
.home-topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 13px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    transition: all var(--transition);
}
.home-topbar-btn svg { width: 15px; height: 15px; color: var(--primary); flex-shrink: 0; }
.home-topbar-btn:hover { border-color: var(--primary); color: var(--primary); }

@media (max-width: 480px) {
    .home-topbar { justify-content: space-between; }
    .home-brand-name { font-size: 14px; }
}

.btn-fp-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(108, 77, 255, .3);
    transition: transform var(--transition), box-shadow var(--transition);
}
.btn-fp-login:hover { transform: scale(1.04); box-shadow: 0 16px 36px rgba(108, 77, 255, .4); }
.fp-badge {
    background: #fff;
    color: var(--primary);
    font-weight: 800;
    font-size: 13px;
    padding: 3px 7px;
    border-radius: 6px;
}

.home-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 34px 0 10px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}
.home-stats .stat { display: flex; align-items: center; gap: 12px; }
.stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.stat-label { color: var(--gray-text); font-size: 13.5px; font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); }

@media (max-width: 640px) {
    .home-logo { width: 80px; height: 80px; font-size: 34px; }
    .home-title { font-size: 32px; }
    .home-stats { justify-content: flex-start; gap: 24px; }
}

/* ---------------- Inline FaucetPay login (on the home page) ---------------- */
.fp-login-inline { max-width: 480px; margin: 0 auto; }
.fp-login-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 7px 7px 14px;
    margin-top: 16px;
    box-shadow: 0 8px 24px rgba(108, 77, 255, .10);
}
.fp-login-row .form-control {
    border: none;
    flex: 1;
    min-width: 0;
    padding: 10px 4px;
}
.fp-login-row .form-control:focus { outline: none; box-shadow: none; }
.fp-login-row .btn-fp-login { flex: 0 0 auto; padding: 9px 18px; font-size: 13.5px; white-space: nowrap; }

@media (max-width: 560px) {
    .fp-login-row { flex-wrap: wrap; padding: 14px; }
    .fp-login-row .form-control { flex: 1 1 100%; order: 2; }
    .fp-login-row .btn-fp-login { flex: 1 1 100%; order: 3; }
    .fp-login-row .fp-badge { order: 1; }
}

.btn-secondary {
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-weight: 600;
    font-size: 13.5px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-secondary:hover { background: var(--bg); }

/* ---------------- Icon captcha widget (checkbox gate → reveal challenge) ---------------- */
.captcha-widget { max-width: 320px; margin: 18px auto 0; text-align: left; }

.captcha-gate {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    user-select: none;
}
.captcha-gate input[type="checkbox"] { display: none; }
.captcha-gate-box {
    width: 19px; height: 19px;
    border: 2px solid #C4C4C4;
    border-radius: 4px;
    flex: 0 0 auto;
    position: relative;
    transition: all var(--transition);
}
.captcha-gate input:checked ~ .captcha-gate-box {
    border-color: var(--primary);
    background: var(--primary);
}
.captcha-gate input:checked ~ .captcha-gate-box::after {
    content: '';
    position: absolute;
    left: 5px; top: 2px;
    width: 5px; height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.captcha-gate-label { font-weight: 500; color: var(--text); font-size: 13px; }
.captcha-secure-icon {
    width: 18px;
    height: 18px;
    color: #9CA3AF;
    margin-left: auto;
    flex-shrink: 0;
}

.captcha-challenge {
    display: none;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.captcha-challenge.open { display: block; }

.captcha-challenge-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 12.5px;
    color: var(--text);
    margin-bottom: 10px;
    gap: 8px;
}
.captcha-target-box {
    width: 30px; height: 30px;
    border: 1px solid var(--border);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex: 0 0 auto;
}

.captcha-options {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
}
.captcha-option {
    flex: 1 1 0;
    min-width: 0;
    aspect-ratio: 1 / 1;
    font-size: 17px;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    transition: all var(--transition);
}
.captcha-option:hover { border-color: var(--light-purple); }
.captcha-option.wrong { animation: shakeX .4s ease; border-color: #DC2626; }

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

@media (max-width: 360px) {
    .captcha-widget { max-width: 100%; }
    .captcha-option { font-size: 14px; }
    .captcha-target-box { width: 26px; height: 26px; font-size: 13px; }
}

/* ---------------- Footer ---------------- */
.site-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 70px;
    color: var(--gray-text);
    font-size: 14px;
    flex-wrap: wrap;
    gap: 10px;
}
.site-footer a { color: var(--gray-text); text-decoration: none; transition: color var(--transition); }
.site-footer a:hover { color: var(--primary); }

/* ---------------- Animations ---------------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glowPulse {
    0%, 100% { filter: drop-shadow(0 0 0 rgba(108,77,255,0)); }
    50% { filter: drop-shadow(0 0 18px rgba(108,77,255,.35)); }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1300px) {
    .ads-grid { grid-template-columns: repeat(3, 1fr); }
}

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

@media (max-width: 640px) {
    .container { padding: 18px 12px; }
    .main-card { padding: 20px 16px; border-radius: 18px; }
    .balance-card .value { font-size: 40px; }
    .ads-grid { grid-template-columns: 1fr; gap: 16px; }
    .menu-pills { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    .menu-pills::-webkit-scrollbar { display: none; }
    .menu-pills a { flex: 0 0 auto; }
    .site-footer { flex-direction: column; text-align: center; }
}

/* Disallow text selection / dragging on ad artwork per requirement */
img, .no-select { -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }