/* Reset & Fonts */
:root {
    --bg-main: #090d16;
    --bg-card: #111726;
    --bg-card-hover: #161f33;
    --border: #1e293b;
    --border-glow: #00f0ff33;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --cyan: #00f0ff;
    --cyan-glow: rgba(0, 240, 255, 0.3);
    --green: #10b981;
    --green-glow: rgba(16, 185, 129, 0.3);
    --purple: #a855f7;
    --purple-glow: rgba(168, 85, 247, 0.3);
    --red: #ef4444;
    --yellow: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Nav */
.header {
    background: rgba(17, 23, 38, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 15px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: 1px;
}

.logo span {
    color: var(--cyan);
    text-shadow: 0 0 12px var(--cyan-glow);
}

.user-balance-badge {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-balance-badge span {
    color: var(--green);
    font-weight: 700;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #00d2ff, #0077ff);
    color: #fff;
    box-shadow: 0 4px 14px var(--cyan-glow);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid #334155;
    color: var(--text-main);
}

.btn-outline:hover {
    background: #1e293b;
    border-color: var(--cyan);
}

.btn-quest-hub {
    background: linear-gradient(135deg, #a855f7, #6366f1);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 0 16px var(--purple-glow);
    animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 10px var(--purple-glow); }
    50% { box-shadow: 0 0 25px rgba(168, 85, 247, 0.6); }
    100% { box-shadow: 0 0 10px var(--purple-glow); }
}

/* Hero Section */
.hero {
    padding: 40px 0 20px;
    text-align: center;
}

.hero h1 {
    font-size: 38px;
    font-weight: 800;
    margin-bottom: 12px;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 17px;
    max-width: 650px;
    margin: 0 auto 25px;
}

.hero-banner {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.15), rgba(0, 240, 255, 0.15));
    border: 1px dashed var(--cyan);
    border-radius: 12px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 900px;
    margin: 0 auto;
    text-align: left;
    gap: 15px;
}

.hero-banner-text strong {
    color: var(--cyan);
    font-size: 16px;
}

.hero-banner-text p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 3px;
}

/* Search Bar Section */
.search-section {
    margin: 30px auto;
    max-width: 800px;
}

.search-box {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--cyan);
    box-shadow: 0 0 15px var(--cyan-glow);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    padding: 10px 16px;
    font-size: 15px;
}

.search-box input::placeholder {
    color: #475569;
}

/* SQL Feedback Alert */
.sql-debug-box {
    background: #181124;
    border: 1px solid var(--purple);
    border-radius: 8px;
    padding: 14px;
    margin-top: 15px;
    font-size: 13px;
    display: none;
}

.sql-debug-box.visible {
    display: block;
}

.sql-debug-box code {
    background: #090610;
    color: #f43f5e;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    display: block;
    margin: 8px 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Products Grid */
.products-section {
    padding: 30px 0 60px;
}

.section-title {
    font-size: 22px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
    position: relative;
}

.product-card:hover {
    border-color: #334155;
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.product-card.vip {
    border-color: rgba(245, 158, 11, 0.5);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 100%);
}

.product-card.secret {
    border-color: #f43f5e;
    background: linear-gradient(180deg, rgba(244, 63, 94, 0.1) 0%, var(--bg-card) 100%);
    animation: secretPulse 2s infinite;
}

@keyframes secretPulse {
    0% { border-color: rgba(244, 63, 94, 0.4); }
    50% { border-color: rgba(244, 63, 94, 1); box-shadow: 0 0 20px rgba(244, 63, 94, 0.4); }
    100% { border-color: rgba(244, 63, 94, 0.4); }
}

.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(6px);
    border: 1px solid #334155;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--cyan);
}

.product-card.vip .card-badge {
    color: #fbbf24;
    border-color: #fbbf2466;
}

.product-icon {
    font-size: 55px;
    text-align: center;
    padding: 35px 0 20px;
    user-select: none;
}

.card-content {
    padding: 0 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-category {
    font-size: 12px;
    color: var(--cyan);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 18px;
    font-weight: 700;
    margin: 6px 0 10px;
}

.product-desc {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
    flex: 1;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 15px;
}

.price-box {
    display: flex;
    flex-direction: column;
}

.price-box .price {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
}

.price-box .old-price {
    font-size: 12px;
    color: #64748b;
    text-decoration: line-through;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

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

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    padding: 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background: #0b0f19;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

.form-input:focus {
    border-color: var(--cyan);
}

/* Cart Specific Styles */
.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0b0f19;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #1e293b;
    margin-bottom: 12px;
}

.cart-item-title {
    font-weight: 600;
    font-size: 14px;
}

.cart-item-price {
    font-weight: 700;
    color: var(--cyan);
}

.promo-input-row {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.receipt-alert {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--green);
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.flag-box {
    background: #052e16;
    border: 1px dashed var(--green);
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
    font-weight: 700;
    color: #4ade80;
    margin-top: 10px;
    word-break: break-all;
    user-select: all;
}

/* SIDEBAR: Quest Hub */
.quest-drawer {
    position: fixed;
    top: 0;
    right: -520px;
    width: 500px;
    max-width: 95vw;
    height: 100vh;
    background: #0d121f;
    border-left: 1px solid var(--border);
    box-shadow: -15px 0 40px rgba(0, 0, 0, 0.6);
    z-index: 110;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.quest-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: #111726;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-title h2 {
    font-size: 18px;
    font-weight: 800;
    color: var(--cyan);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Progress Bar in Drawer */
.progress-card {
    background: #141c2e;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 16px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
}

.progress-track {
    background: #0b0f19;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--purple));
    width: 0%;
    transition: width 0.4s ease;
}

/* Quest Level Card */
.quest-card {
    background: #141c2e;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 16px;
    transition: border-color 0.2s;
}

.quest-card.solved {
    border-color: var(--green);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.05), #141c2e);
}

.quest-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.quest-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    background: #1e293b;
    color: var(--cyan);
}

.quest-card.solved .quest-tag {
    background: #052e16;
    color: #4ade80;
}

.quest-card h4 {
    font-size: 15px;
    margin-bottom: 6px;
}

.quest-briefing {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
    margin-bottom: 14px;
}

/* Hints Accordion */
.hints-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.hint-btn {
    background: #0b0f19;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.hint-btn:hover {
    background: #162035;
    border-color: #334155;
}

.hint-body {
    background: #090d16;
    border: 1px dashed #334155;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #cbd5e1;
    display: none;
    margin-top: -4px;
}

.hint-body.active {
    display: block;
}

.hint-body code {
    background: #1e293b;
    color: var(--cyan);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: monospace;
}

/* Flag Input row */
.flag-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.flag-input {
    flex: 1;
    background: #0b0f19;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 12px;
    color: var(--text-main);
    font-family: monospace;
}

.flag-input:focus {
    border-color: var(--cyan);
    outline: none;
}

/* Footer & Notes */
.footer {
    border-top: 1px solid var(--border);
    padding: 40px 0 30px;
    margin-top: 60px;
    background: #0b0f19;
}

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

.footer h5 {
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--text-main);
}

.footer p, .footer a {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    text-decoration: none;
}

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

.dev-ticket-box {
    background: #141c2e;
    border-left: 3px solid var(--yellow);
    padding: 12px 14px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 12px;
}

/* Order Page Specifics */
.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    max-width: 700px;
    margin: 30px auto;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.badge-success { background: #052e16; color: #4ade80; border: 1px solid #166534; }
.badge-secret { background: #450a0a; color: #f87171; border: 1px solid #991b1b; }
.badge-danger { background: #450a0a; color: #f87171; }

.educational-tip {
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--cyan);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    gap: 15px;
    max-width: 700px;
    margin: 20px auto 0;
}

.educational-tip .tip-icon { font-size: 24px; }
.educational-tip p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.order-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 25px;
}

.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-item.full-width { grid-column: span 2; }
.detail-item .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; }
.detail-item .value { font-size: 15px; }

.secret-note {
    background: #141c2e;
    border: 1px dashed var(--yellow);
    border-radius: 10px;
    padding: 16px;
}

.secret-flag-box {
    border-color: #f43f5e;
    background: rgba(244, 63, 94, 0.08);
}

.flag-highlight {
    margin-top: 10px;
    font-size: 12px;
    color: var(--cyan);
    font-weight: 700;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-content { flex-direction: column; height: auto; padding: 15px 0; }
    .hero h1 { font-size: 28px; }
    .hero-banner { flex-direction: column; text-align: center; }
    .quest-drawer { width: 100vw; }
    .footer-grid { grid-template-columns: 1fr; }
}
