/* =====================================================
   JAV Coin Site - Dark Theme (Clean & Mobile Ready)
   ===================================================== */

:root {
    --bg: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-hover: #252525;
    --border: #2a2a2a;
    --text: #e5e5e5;
    --text-muted: #999;
    --primary: #e11d48;
    --primary-hover: #be123c;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 10px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ========== HEADER ========== */
.site-header {
    background: rgba(15, 15, 15, 0.97);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 12px;
}

.logo {
    font-weight: 700;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.logo-icon {
    background: var(--primary);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.main-nav {
    display: flex;
    gap: 4px;
    align-items: center;
}

.main-nav a {
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s;
}

.main-nav a:hover {
    background: var(--bg-hover);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.coin-balance {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-menu {
    position: relative;
}

.user-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    min-width: 170px;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    overflow: hidden;
}

.dropdown.show {
    display: block;
}

.dropdown a {
    display: block;
    padding: 10px 16px;
    font-size: 0.9rem;
}

.dropdown a:hover {
    background: var(--bg-hover);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    color: inherit;
}

.btn-primary {
    background: var(--primary);
    color: #fff !important;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text) !important;
}

.btn-outline:hover {
    background: var(--bg-hover);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-earn {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: #000 !important;
    font-weight: 700 !important;
}

/* ========== FLASH ========== */
.flash {
    padding: 12px 0;
    font-size: 0.9rem;
}

.flash-success { background: rgba(16,185,129,0.15); color: #34d399; }
.flash-danger  { background: rgba(239,68,68,0.15); color: #f87171; }
.flash-error   { background: rgba(239,68,68,0.15); color: #f87171; }
.flash-info    { background: rgba(59,130,246,0.15); color: #60a5fa; }

.flash .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.3rem;
    cursor: pointer;
}

/* ========== MAIN ========== */
.main-content {
    min-height: calc(100vh - 60px - 180px);
    padding: 20px 0 40px;
}

.page-header {
    margin: 12px 0 20px;
}

.page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

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

.section {
    margin: 32px 0;
}

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

.section-header h2 {
    font-size: 1.2rem;
}

.see-all {
    font-size: 0.9rem;
    color: var(--primary);
}

/* ========== VIDEO GRID ========== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.video-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid transparent;
}

.video-card:hover {
    transform: translateY(-3px);
    border-color: var(--border);
    box-shadow: 0 8px 20px rgba(0,0,0,0.35);
}

.video-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: #111;
    overflow: hidden;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.badge {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 4px;
    color: #fff;
}

.badge.coin-price {
    background: var(--primary);
}

.badge.free {
    background: var(--success);
}

.badge.unlocked {
    background: #3b82f6;
}

.badge.featured {
    background: var(--accent);
    color: #000;
    left: auto;
    right: 6px;
}

.video-info {
    padding: 10px 12px 12px;
}

.video-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-meta {
    display: flex;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.video-meta .category {
    color: var(--primary);
}

/* ========== CATEGORY ========== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: border-color 0.15s, transform 0.15s;
}

.category-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.category-card h3 {
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.category-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========== WATCH PAGE ========== */
.watch-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    margin-top: 12px;
}

.player-wrapper {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.video-player {
    width: 100%;
    height: 100%;
}

.player-locked {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}

.lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.78);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lock-content {
    text-align: center;
    padding: 24px;
    max-width: 380px;
}

.lock-icon {
    font-size: 2.8rem;
    margin-bottom: 10px;
}

.preview-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 14px;
}

.video-detail {
    margin-top: 14px;
}

.video-detail h1 {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.video-detail-meta {
    color: var(--text-muted);
    font-size: 0.88rem;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.video-description {
    margin-top: 14px;
    line-height: 1.7;
    color: #ccc;
    font-size: 0.95rem;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.related-item {
    display: flex;
    gap: 10px;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s;
}

.related-item:hover {
    background: var(--bg-hover);
}

.related-item img {
    width: 110px;
    height: 62px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.related-item h4 {
    font-size: 0.85rem;
    margin-bottom: 3px;
    line-height: 1.3;
}

.related-item span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== EARN PAGE ========== */
.earn-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin: 20px 0 32px;
}

.earn-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.earn-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.earn-reward {
    color: var(--accent);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 6px 0 14px;
}

.earn-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 16px;
    font-size: 0.88rem;
}

.earn-stats .label {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.referral-box {
    background: #111;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

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

/* ========== DASHBOARD STATS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
}

.stat-icon {
    font-size: 1.6rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 6px 0 2px;
}

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

.stat-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.82rem;
    color: var(--primary);
}

/* ========== AUTH ========== */
.auth-container {
    display: flex;
    justify-content: center;
    padding: 40px 16px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    margin-bottom: 4px;
    font-size: 1.4rem;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 22px;
    font-size: 0.95rem;
}

.auth-form .form-group {
    margin-bottom: 14px;
}

.auth-form label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.88rem;
}

.auth-form input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #111;
    color: var(--text);
    font-size: 0.95rem;
}

.auth-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary);
}

/* ========== FORM ========== */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.88rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #111;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ========== TABLE ========== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.82rem;
}

.table-responsive {
    overflow-x: auto;
}

/* ========== FILTERS ========== */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    justify-content: space-between;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-form input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #111;
    color: var(--text);
    min-width: 180px;
}

.filter-selects {
    display: flex;
    gap: 8px;
}

.filter-selects select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #111;
    color: var(--text);
}

/* ========== ALERT ========== */
.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 0.9rem;
}

.alert-danger {
    background: #3f1a1a;
    border: 1px solid var(--danger);
    color: #fca5a5;
}

.alert-success {
    background: #1a3f2e;
    border: 1px solid var(--success);
    color: #6ee7b7;
}

/* ========== EMPTY & PAGINATION ========== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 28px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 7px 12px;
    border-radius: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.88rem;
}

.pagination a:hover {
    background: var(--bg-hover);
}

.pagination .active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ========== ANNOUNCEMENTS ========== */
.announcements {
    margin: 12px 0 20px;
}

.announcement {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    border-left: 4px solid;
    font-size: 0.92rem;
}

.announcement-info {
    background: #1e3a5f;
    border-color: #3b82f6;
}

.announcement-warning {
    background: #3f2e1a;
    border-color: var(--accent);
}

.announcement-promo {
    background: #1a3f2e;
    border-color: var(--success);
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.ad-progress {
    height: 8px;
    background: #333;
    border-radius: 4px;
    margin: 18px 0;
    overflow: hidden;
}

.ad-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
}

/* ========== FOOTER ========== */
.site-footer {
    background: #0a0a0a;
    border-top: 1px solid var(--border);
    padding: 36px 0 20px;
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 28px;
    margin-bottom: 28px;
}

.footer-grid h4 {
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.footer-grid p,
.footer-grid a {
    display: block;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.footer-grid a:hover {
    color: var(--text);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ========== UTILS ========== */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.hint { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }
.badge-type {
    background: #333;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
    .watch-layout {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: #1a1a1a;
        flex-direction: column;
        padding: 10px;
        border-bottom: 1px solid var(--border);
        z-index: 99;
    }

    .main-nav.show {
        display: flex;
    }

    .main-nav a {
        width: 100%;
        padding: 12px 16px;
    }

    .mobile-toggle {
        display: block;
    }

    /* Keep login/register visible on mobile */
    .header-right .btn {
        padding: 7px 12px;
        font-size: 0.82rem;
    }

    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .auth-container {
        padding: 24px 12px;
    }
}

@media (max-width: 400px) {
    .logo {
        font-size: 1rem;
    }
    .header-right .btn-outline {
        display: none; /* hide login on very small, keep daftar */
    }
}

/* ========== CUSTOM VIDEO PLAYER ========== */
.player-wrapper {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
}

.player-wrapper video {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    padding: 28px 12px 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.player-wrapper:hover .custom-controls,
.player-wrapper:focus-within .custom-controls {
    opacity: 1;
}

.progress-bar {
    height: 5px;
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 10px;
}

.progress-filled {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: background 0.15s;
}

.ctrl-btn:hover {
    background: rgba(255,255,255,0.15);
}

.volume-slider {
    width: 70px;
    height: 4px;
    accent-color: var(--primary);
    cursor: pointer;
}

.time-display {
    font-size: 0.8rem;
    color: #ddd;
    margin-left: 4px;
    white-space: nowrap;
}

.video-actions {
    display: flex;
    gap: 10px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.video-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    transition: opacity 0.15s;
    color: #fff;
}

.video-card:hover .play-overlay {
    opacity: 1;
}

.related-thumb {
    position: relative;
    flex-shrink: 0;
}

.related-thumb img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
}

.related-thumb .duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.85);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 3px;
}

.related-info h4 {
    font-size: 0.88rem;
    line-height: 1.3;
    margin-bottom: 4px;
}

.logo-text {
    font-weight: 700;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lock-icon {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.saldo-info {
    margin: 8px 0 14px;
    font-size: 0.95rem;
}

@media (max-width: 600px) {
    .volume-slider {
        display: none;
    }
    .time-display {
        font-size: 0.75rem;
    }
    .custom-controls {
        padding: 20px 8px 8px;
    }
}
