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

:root {
    --bg-primary: #09090b;
    --bg-secondary: #18181b;
    --bg-card: #1c1c21;
    --bg-card-hover: #222228;
    --bg-elevated: #27272a;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #10b981;
    --accent-light: #34d399;
    --accent-dark: #059669;
    --accent-muted: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-muted: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-muted: rgba(239, 68, 68, 0.12);
    --info: #6366f1;
    --info-muted: rgba(99, 102, 241, 0.12);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Subtle mesh gradient background */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(16, 185, 129, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 10%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 100%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
}

/* Navbar */
.navbar {
    background: rgba(9, 9, 11, 0.8) !important;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 0.65rem 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand .brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
}

.navbar .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.45rem 0.85rem !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.navbar .nav-link:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.04);
}

.navbar .nav-link.text-danger:hover {
    background: var(--danger-muted) !important;
}

.navbar .badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    font-weight: 600;
}

.balance-pill {
    background: var(--warning-muted);
    color: var(--warning);
    padding: 0.35rem 0.85rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(245, 158, 11, 0.15);
}

/* Main Content */
.main-content {
    position: relative;
    z-index: 1;
    padding-top: 70px;
    min-height: 100vh;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 1.4rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.card-body {
    padding: 1.4rem;
}

/* Buttons */
.btn {
    font-weight: 600;
    padding: 0.55rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 0.875rem;
    border: none;
    letter-spacing: -0.1px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1a2e;
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-outline-light {
    border: 1px solid var(--border-hover);
    color: var(--text-primary);
    background: transparent;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 0.95rem;
}

/* Forms */
.form-control, .form-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
    background: var(--bg-secondary);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}

.form-text, .form-control+.form-text {
    color: var(--text-muted) !important;
    font-size: 0.78rem;
}

.input-group .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.form-check-input {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.form-check-input:checked {
    background: var(--accent);
    border-color: var(--accent);
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 0.85rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.alert-success {
    background: var(--accent-muted);
    color: var(--accent-light);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.alert-danger {
    background: var(--danger-muted);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.alert-warning {
    background: var(--warning-muted);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.15);
}

.alert-info {
    background: var(--info-muted);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

/* Tables */
.table {
    color: var(--text-primary);
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.7rem 1rem;
}

.table tbody td {
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 1rem;
    vertical-align: middle;
    font-size: 0.85rem;
}

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

.table-dark {
    --bs-table-bg: transparent;
}

/* Badges */
.badge {
    font-weight: 600;
    padding: 0.3em 0.6em;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    letter-spacing: 0.2px;
}

/* Modal */
.modal {
    z-index: 99999 !important;
}
.modal-backdrop {
    z-index: 1 !important;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.15rem 1.4rem;
}

.modal-body {
    padding: 1.4rem;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 0.9rem 1.4rem;
}

.modal .btn-close {
    filter: invert(1) brightness(200%);
}

/* Override Bootstrap text colors for dark theme */
.text-secondary, .text-muted {
    color: var(--text-secondary) !important;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link) {
    color: var(--accent);
}

a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):hover {
    color: var(--accent-light);
}

p, .page-header p, .card-body p, .modal-body p {
    color: var(--text-secondary);
}

small, .small, .form-label, label {
    color: var(--text-secondary);
}

.card-header {
    color: var(--text-primary);
}

/* Pagination */
.page-link {
    color: var(--text-secondary);
    background: var(--bg-card);
    border-color: var(--border);
}

.page-link:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.page-item.active .page-link {
    background: var(--accent);
    border-color: transparent;
    color: white;
}

.page-item.disabled .page-link {
    background: var(--bg-card);
    color: var(--text-muted);
    border-color: var(--border);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
    position: relative;
    z-index: 1;
}

/* Auth Pages */
.auth-container {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--info), var(--accent));
}

.auth-card .auth-icon {
    width: 56px;
    height: 56px;
    background: var(--accent-muted);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.4rem;
    color: var(--accent);
}

.auth-card h3 {
    font-weight: 700;
    margin-bottom: 0.4rem;
    font-size: 1.35rem;
    letter-spacing: -0.3px;
}

.auth-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Dashboard Stats */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.3rem;
    transition: all 0.25s ease;
    height: 100%;
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.85rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    letter-spacing: -0.5px;
}

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

/* Ad Cards */
.ad-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    transition: all 0.25s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ad-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.ad-card .ad-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    line-height: 1.35;
}

.ad-card .ad-desc {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px !important;
    line-height: 1.4;
}

.ad-card .ad-meta {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.75rem;
    margin-top: auto;
}

.ad-card .ad-meta span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ad-card .ad-meta .reward {
    color: var(--accent);
    font-weight: 600;
}

/* PTC View Page */
.ptc-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(9, 9, 11, 0.95);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
    z-index: 1000;
    backdrop-filter: blur(16px);
}

.timer-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.timer-bar-wrapper {
    flex: 1;
    background: var(--bg-elevated);
    border-radius: 100px;
    height: 6px;
    overflow: hidden;
    min-width: 80px;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    width: 0%;
    transition: width 0.1s linear;
    border-radius: 100px;
}

.timer-text {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 70px;
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: 0.65rem;
}

.btn-visit {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    opacity: 0.5;
    pointer-events: none;
}

.btn-visit.active {
    opacity: 1;
    pointer-events: auto;
}

.btn-visit.active:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.btn-report {
    background: var(--danger-muted);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-report:hover {
    background: rgba(239, 68, 68, 0.2);
}

.ptc-info-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ptc-warning-text {
    color: var(--warning);
    font-size: 0.78rem;
    margin-top: 0.4rem;
}

.iframe-container {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.focus-warning {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.95);
    color: white;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.825rem;
    z-index: 1001;
    display: none;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
    font-weight: 500;
}

/* Captcha */
.captcha-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    text-align: center;
}

.captcha-container img {
    border-radius: var(--radius-sm);
    max-width: 100%;
    height: auto;
}

.captcha-container .captcha-input {
    max-width: 200px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    .ptc-header {
        padding: 0.6rem 0.85rem;
    }
    .timer-text {
        font-size: 1rem;
        min-width: 55px;
    }
    .action-buttons .btn {
        padding: 0.35rem 0.65rem;
        font-size: 0.72rem;
    }
    .focus-warning {
        white-space: normal;
        text-align: center;
        max-width: 90%;
        font-size: 0.72rem;
    }
    .auth-card {
        padding: 1.5rem;
    }
    .stat-card .stat-value {
        font-size: 1.3rem;
    }
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Page Header */
.page-header {
    padding: 1.75rem 0 1.25rem;
}

.page-header h1 {
    font-weight: 700;
    font-size: 1.65rem;
    margin-bottom: 0.2rem;
    letter-spacing: -0.5px;
}

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

/* Copy Button */
.copy-btn {
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    font-size: 0.82rem;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 76px;
    right: 16px;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.toast-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.toast-body {
    color: var(--text-secondary);
}

.toast .btn-close {
    filter: invert(1) brightness(200%);
}

/* Live indicator */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    background: var(--accent-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 100px;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.live-dot {
    width: 5px;
    height: 5px;
    background: var(--accent);
    border-radius: 50%;
    animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

/* Live update pulse animation */
@keyframes pulse-update {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.pulse-update {
    animation: pulse-update 0.4s ease;
}

/* Ad card entrance animation */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ad-card {
    animation: fade-in-up 0.25s ease;
}

/* Loading Spinner Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay.active {
    display: flex;
}

/* Referral Card */
.referral-link-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    word-break: break-all;
}

.referral-link-box code {
    color: var(--accent);
    font-size: 0.8rem;
}

.banner-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
}

.banner-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.banner-preview {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.border-dashed {
    border: 2px dashed var(--border);
}

.copy-success {
    background: var(--accent) !important;
    color: white !important;
    transition: all 0.2s ease;
}

.copy-success i {
    color: white !important;
}

.toast-custom {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideInRight 0.25s ease;
    box-shadow: var(--shadow-lg);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.btn-disabled, button[disabled], a.disabled-link {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
    filter: grayscale(0.2);
    position: relative;
}
.btn-disabled::after, button[disabled]::after, a.disabled-link::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* Separator line */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0 1.5rem;
}
