/* ================================================================
   ScriptX - main stylesheet (dark marketplace theme)
   ================================================================ */

:root {
    --sx-primary: #7c3aed;
    --sx-primary-2: #a78bfa;
    --sx-accent: #22d3ee;
    --sx-bg: #0b0d14;
    --sx-surface: #12141d;
    --sx-border: rgba(255, 255, 255, 0.08);
    color-scheme: dark;
}

html {
    color-scheme: dark;
}

/* Native selects / form controls - dark popup on Windows/macOS */
select,
option {
    color-scheme: dark;
}

html, body {
    background: var(--sx-bg);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #e5e7eb;
}

a {
    text-decoration: none;
}

/* ---------------- Navbar ---------------- */
.app-navbar {
    background: rgba(11, 13, 20, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--sx-border);
    z-index: 1030;
}

.app-navbar .navbar-brand {
    color: #fff;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
}

.brand-icon {
    color: var(--sx-primary-2);
}

.app-navbar .nav-link {
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.15s ease;
}

.app-navbar .nav-link:hover {
    color: var(--sx-primary-2);
}

.app-navbar .dropdown-menu {
    background: var(--sx-surface);
    border: 1px solid var(--sx-border);
    border-radius: 12px;
    padding: 8px;
    min-width: 220px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.app-navbar .dropdown-item {
    padding: 8px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 0.9rem;
    transition: all 0.15s ease;
}

.app-navbar .dropdown-item:hover {
    background: rgba(124, 58, 237, 0.14);
    color: var(--sx-primary-2);
}

.app-navbar .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.06);
}

/* ---------------- Buttons ---------------- */
.btn-gradient {
    background: linear-gradient(135deg, var(--sx-primary) 0%, #db2777 100%);
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-gradient:hover,
.btn-gradient:focus {
    color: #fff;
    filter: brightness(1.1);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
}

.btn-discord {
    background: #5865F2;
    border: none;
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
}

.btn-discord:hover {
    background: #4752c4;
    color: #fff;
}

.btn-outline-light {
    border-radius: 10px;
}

/* ---------------- Cards ---------------- */
.card {
    background: var(--sx-surface);
    border: 1px solid var(--sx-border);
    border-radius: 16px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--sx-border);
    font-weight: 600;
}

/* ---------------- Hero ---------------- */
.sx-hero {
    position: relative;
    padding: 72px 0 56px;
    text-align: center;
    overflow: hidden;
}

.sx-hero::before {
    content: '';
    position: absolute;
    inset: -40% -10% auto;
    height: 420px;
    background: radial-gradient(closest-side, rgba(124, 58, 237, 0.35), transparent 70%),
                radial-gradient(closest-side at 70% 40%, rgba(34, 211, 238, 0.18), transparent 70%);
    filter: blur(10px);
    pointer-events: none;
}

.sx-hero h1 {
    position: relative;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: clamp(2rem, 5vw, 3.4rem);
}

.sx-hero .gradient-text {
    background: linear-gradient(90deg, var(--sx-primary-2), var(--sx-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.sx-hero p.lead {
    position: relative;
    color: #94a3b8;
    max-width: 640px;
    margin: 16px auto 0;
}

/* ---------------- Search bar ---------------- */
.sx-search {
    position: relative;
    max-width: 640px;
    margin: 28px auto 0;
}

.sx-search .form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--sx-border);
    border-radius: 14px;
    padding: 14px 18px 14px 46px;
    font-size: 1rem;
}

.sx-search .form-control:focus {
    border-color: var(--sx-primary);
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.25);
    background: rgba(255, 255, 255, 0.07);
}

.sx-search i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1.1rem;
}

/* ---------------- Script cards ---------------- */
.script-card {
    background: var(--sx-surface);
    border: 1px solid var(--sx-border);
    border-radius: 16px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.script-card:hover {
    transform: translateY(-4px);
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.script-card .thumb {
    height: 132px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(34, 211, 238, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    color: var(--sx-primary-2);
    position: relative;
    overflow: hidden;
}

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

.script-card .thumb .free-ribbon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #16a34a;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.script-card .card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.script-card h3 {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #f1f5f9;
}

.script-card h3 a {
    color: inherit;
}

.script-card h3 a:hover {
    color: var(--sx-primary-2);
}

.script-card .desc {
    color: #94a3b8;
    font-size: 0.86rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.script-card .meta {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
    color: #64748b;
}

.price-tag {
    font-weight: 800;
    font-size: 1rem;
    color: #fbbf24;
}

.price-tag.free {
    color: #4ade80;
}

.publisher-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 0.82rem;
    max-width: 100%;
}

.publisher-line img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.publisher-line:hover {
    color: var(--sx-primary-2);
}

/* ---------------- Badges ---------------- */
.badge-cat {
    background: rgba(124, 58, 237, 0.16);
    color: var(--sx-primary-2);
    border: 1px solid rgba(124, 58, 237, 0.35);
    font-weight: 600;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--sx-border);
    border-radius: 12px;
    padding: 14px 18px;
}

.stat-pill .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1.1;
}

.stat-pill .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

/* ---------------- Forms ---------------- */
.form-control, .form-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--sx-border);
    color: #e5e7eb;
    border-radius: 10px;
}

.form-control:focus, .form-select:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--sx-primary);
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.2);
    color: #fff;
}

.form-control::placeholder {
    color: #64748b;
}

.form-label {
    color: #cbd5e1;
    font-weight: 600;
    font-size: 0.9rem;
}

.input-group-text {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--sx-border);
    color: #94a3b8;
}

textarea.code-editor {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    tab-size: 2;
    min-height: 420px;
    white-space: pre;
}

/* ---------------- Detail page ---------------- */
.sx-detail-head {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(34, 211, 238, 0.07));
    border: 1px solid var(--sx-border);
    border-radius: 20px;
    padding: 28px;
}

.sx-detail-head .cover {
    width: 96px;
    height: 96px;
    border-radius: 18px;
    object-fit: cover;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.4), rgba(34, 211, 238, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    color: var(--sx-primary-2);
    flex-shrink: 0;
    overflow: hidden;
}

.sx-detail-head .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.code-box {
    background: #0a0c12;
    border: 1px solid var(--sx-border);
    border-radius: 14px;
    padding: 16px;
    max-height: 480px;
    overflow: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.55;
    color: #a5f3fc;
    white-space: pre;
}

/* ---------------- Publisher / admin panels ---------------- */
.panel-nav .nav-link {
    color: #94a3b8;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.92rem;
}

.panel-nav .nav-link:hover {
    color: var(--sx-primary-2);
    background: rgba(124, 58, 237, 0.1);
}

.panel-nav .nav-link.active {
    background: rgba(124, 58, 237, 0.18);
    color: #fff;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: #cbd5e1;
    --bs-table-border-color: var(--sx-border);
}

.table thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: #64748b;
    font-weight: 700;
}

/* ---------------- Payment method cards ---------------- */
.method-card {
    border: 1px solid var(--sx-border);
    border-radius: 16px;
    padding: 20px;
    background: var(--sx-surface);
    height: 100%;
}

.method-card.active-method {
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.15);
}

.method-card .method-status {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.method-card .method-status.on { color: #4ade80; }
.method-card .method-status.off { color: #64748b; }

/* ---------------- Auth pages ---------------- */
.auth-card {
    border: 1px solid var(--sx-border);
    border-radius: 20px;
    background: var(--sx-surface);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.btn-google {
    background: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
    font-weight: 600;
    border-radius: 10px;
}

.btn-google:hover {
    background: #f8f9fa;
    color: #202124;
    border-color: #ced4da;
}

/* ---------------- Footer ---------------- */
.app-footer {
    background: #08090f;
    border-top: 1px solid var(--sx-border);
    margin-top: 48px;
}

.footer-link {
    color: #94a3b8;
    transition: color 0.15s ease;
}

.footer-link:hover {
    color: var(--sx-primary-2);
}

.form-select, .form-control {
    color-scheme: dark;
    background-color: #1a1d29;
    color: #e5e7eb;
}

.form-select option,
.form-select optgroup {
    background: #1a1d29;
    color: #e5e7eb;
}

.form-select:invalid,
.form-select option[value=""] {
    color: #94a3b8;
}

/* Bootstrap dropdown menus - dark everywhere, not just navbar */
.dropdown-menu,
.dropdown-menu.show {
    background: #1a1d29 !important;
    border: 1px solid var(--sx-border) !important;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    color: #e5e7eb !important;
}

.dropdown-item {
    color: #cbd5e1 !important;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item:active {
    background: rgba(124, 58, 237, 0.14) !important;
    color: var(--sx-primary-2) !important;
}

.dropdown-divider {
    border-color: rgba(255, 255, 255, 0.06);
}

.dropdown-header {
    color: #64748b;
}

/* ---------------- Misc ---------------- */
.divider-or {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #64748b;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 20px 0;
}

.divider-or::before,
.divider-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--sx-border);
}

.gateway-option {
    border: 1px solid var(--sx-border);
    border-radius: 14px;
    padding: 16px 18px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(255, 255, 255, 0.02);
}

.gateway-option:hover {
    border-color: rgba(167, 139, 250, 0.55);
    background: rgba(124, 58, 237, 0.08);
}

.gateway-option.selected {
    border-color: var(--sx-primary);
    background: rgba(124, 58, 237, 0.14);
}

.pay-qr {
    background: #fff;
    padding: 12px;
    border-radius: 16px;
    display: inline-block;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.pay-qr svg {
    display: block;
    width: 180px;
    height: 180px;
}

.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
}

.sx-pagination .page-link {
    background: transparent;
    border-color: var(--sx-border);
    color: #cbd5e1;
    border-radius: 10px !important;
    margin: 0 3px;
}

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

/* Publisher header on detail page */
.publisher-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--sx-surface);
    border: 1px solid var(--sx-border);
    border-radius: 16px;
    padding: 16px;
}

.publisher-card img.avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
}

@media (max-width: 991.98px) {
    .app-navbar .dropdown-menu {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
    }
    .app-navbar .dropdown-item {
        border-radius: 0;
        padding: 8px 12px;
    }
}
