:root {
    --bg-dark: #0f1117;
    --bg-card: #1a1d27;
    --bg-card-hover: #222634;
    --border-color: #2b3042;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #ec4899;
    --accent-gold: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* NAVBAR */
.navbar {
    background-color: rgba(26, 29, 39, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #fff;
}

.brand-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.online-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

.vip-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000 !important;
    font-weight: 700;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
}

.vip-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: #3f455d;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

/* MAIN LAYOUT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* AD WRAPPERS (Removed for Premium Users) */
.ad-wrapper {
    background: rgba(26, 29, 39, 0.5);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    margin: 0.75rem auto;
    padding: 0.5rem;
    text-align: center;
    max-width: 900px;
    width: calc(100% - 1.5rem);
}

.ad-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.ad-placeholder {
    height: clamp(55px, 8vw, 85px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #1e2230, #252a3b);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    padding: 0.5rem;
    text-align: center;
}

/* HERO SECTION */
.hero-section {
    padding: clamp(1.5rem, 4vw, 3rem) 1.25rem;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.hero-title {
    font-size: clamp(1.85rem, 5vw, 2.75rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 40%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* FILTER BAR */
.filter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: clamp(1rem, 3vw, 1.75rem);
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    width: 100%;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.lock-badge {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.form-select, .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: #12141c;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-select:focus, .form-input:focus {
    border-color: var(--primary);
}

/* =======================================================
   VIDEO CHAT INTERFACE (FULLY RESPONSIVE)
   ======================================================= */
.chat-container {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1rem;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    height: calc(100vh - 75px);
}

.video-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    min-height: 0;
}

.video-screens {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    min-height: 350px;
    position: relative;
}

.video-box {
    background: #090a0f;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

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

/* User Camera Mirroring: Local webcam mirrored like a selfie mirror, Remote webcam normal */
#localVideo {
    transform: scaleX(-1);
    -webkit-transform: scaleX(-1);
    transition: transform 0.25s ease;
}

#localVideo.unmirrored {
    transform: scaleX(1) !important;
    -webkit-transform: scaleX(1) !important;
}

#remoteVideo {
    transform: scaleX(1);
    -webkit-transform: scaleX(1);
}

.video-label {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(15, 17, 23, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 10;
}

.video-status-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(9, 10, 15, 0.88);
    color: var(--text-muted);
    gap: 1rem;
    z-index: 5;
    text-align: center;
    padding: 1.5rem;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* CONTROLS BAR */
.controls-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.controls-main {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.controls-filters {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn-skip {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.btn-skip:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #12141c;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-icon:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

.btn-icon.active-off {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
    color: var(--danger);
}

/* TEXT CHAT PANEL */
.chat-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.messages-list {
    flex: 1;
    padding: 0.85rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.msg-item {
    max-width: 85%;
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    word-break: break-word;
    line-height: 1.4;
}

.msg-me {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.msg-stranger {
    align-self: flex-start;
    background: #252a3b;
    color: var(--text-main);
    border-bottom-left-radius: 2px;
}

.msg-system {
    align-self: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    text-align: center;
    max-width: 95%;
}

.chat-input-bar {
    padding: 0.65rem 0.85rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    background: #12141c;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
}

.chat-input:focus {
    border-color: var(--primary);
}

/* MODALS */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: clamp(1.25rem, 3vw, 2rem);
    max-width: min(520px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-title {
    font-size: clamp(1.15rem, 3vw, 1.4rem);
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PRICING PLANS */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1rem;
    width: 100%;
}

.plan-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 3vw, 2rem);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s, border-color 0.2s;
}

.plan-card.featured {
    border-color: var(--accent-gold);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.2);
}

.plan-card:hover {
    transform: translateY(-4px);
}

.plan-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--accent-gold);
    color: #000;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    text-transform: uppercase;
}

.plan-name {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.plan-price {
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    margin: 0.75rem 0;
}

.plan-features {
    list-style: none;
    margin: 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.92rem;
    color: var(--text-muted);
}

/* ADMIN PANEL (RESPONSIVE) */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 65px);
    width: 100%;
}

.admin-sidebar {
    background: #141720;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.admin-link.active, .admin-link:hover {
    background: var(--bg-card);
    color: #fff;
}

.admin-body {
    padding: clamp(1rem, 3vw, 2rem);
    background: var(--bg-dark);
    min-width: 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}

.stat-num {
    font-size: 1.85rem;
    font-weight: 800;
    color: #fff;
    margin-top: 0.4rem;
}

/* RESPONSIVE TABLE CONTAINER */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    min-width: 650px; /* guarantees readability on mobile with scroll */
}

.data-table th, .data-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

.data-table th {
    background: #151822;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

/* FOOTER */
.footer {
    background: #0b0d13;
    border-top: 1px solid var(--border-color);
    padding: 2rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.footer-links {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.compliance-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--primary);
    white-space: nowrap;
}

/* =======================================================
   RESPONSIVE MEDIA QUERIES (MOBILE & TABLET TWEAKS)
   ======================================================= */

/* Tablet & Mobile Screens (<= 992px) */
@media (max-width: 992px) {
    .chat-container {
        grid-template-columns: 1fr;
        height: auto;
        padding: 0.75rem;
    }

    .video-area {
        height: auto;
    }

    .video-screens {
        min-height: 380px;
        height: 50vh;
        max-height: 480px;
    }

    .chat-panel {
        height: 350px;
        min-height: 300px;
    }

    /* Admin Sidebar turns into horizontal scrollable navigation */
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        gap: 0.5rem;
    }

    .admin-sidebar .admin-link {
        padding: 0.5rem 0.85rem;
        font-size: 0.85rem;
    }

    .admin-sidebar hr {
        display: none;
    }

    .payment-settings-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
}

/* Smartphone Screens (<= 768px) */
@media (max-width: 768px) {
    .navbar {
        padding: 0.6rem 1rem;
    }

    .nav-brand {
        font-size: 1.2rem;
    }

    .brand-icon {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }

    .nav-links {
        gap: 0.5rem;
    }

    .online-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.78rem;
    }

    .vip-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    .btn-secondary, .btn-primary {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    /* MOBILE VIDEO CHAT: Stranger is Full Screen, Local user floats in Picture-in-Picture! */
    .video-screens {
        display: block;
        position: relative;
        height: 48vh;
        min-height: 280px;
        max-height: 420px;
    }

    #strangerVideoBox {
        width: 100%;
        height: 100%;
        position: absolute;
        inset: 0;
    }

    #localVideoBox {
        position: absolute;
        bottom: 12px;
        right: 12px;
        width: 105px;
        height: 140px;
        z-index: 20;
        border-radius: var(--radius-sm);
        border: 2px solid rgba(255, 255, 255, 0.25);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    }

    #localVideoBox .video-label {
        top: 0.3rem;
        left: 0.3rem;
        padding: 0.15rem 0.4rem;
        font-size: 0.65rem;
    }

    .controls-bar {
        padding: 0.65rem;
        gap: 0.5rem;
    }

    .controls-main {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .btn-skip {
        flex: 1;
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }

    .controls-filters {
        width: 100%;
        display: flex;
        gap: 0.4rem;
        justify-content: space-between;
    }

    .controls-filters .form-select {
        flex: 1;
        font-size: 0.8rem;
        padding: 0.45rem 0.6rem;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
