/* ============================================
   FoamHub — Core Styles (Dark Theme)
   ============================================ */

:root {
    --bg: #0f1115;
    --bg-secondary: #171a21;
    --bg-card: #1c2029;
    --bg-input: #232833;
    --border: #2a3040;
    --border-hover: #3a4154;

    --text: #e8eaf0;
    --text-secondary: #9aa3b5;
    --text-muted: #6b7385;

    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --primary-soft: rgba(56, 189, 248, 0.12);
    --accent: #f59e0b;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --purple: #8b5cf6;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

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

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #0b1220; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-card); }
.btn-success { background: var(--success); color: #04120c; }
.btn-success:hover { filter: brightness(1.1); color: #fff; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.4); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: var(--font);
    transition: border-color 0.2s;
    outline: none;
}
.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa3b5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.form-check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }

/* ===== Stats ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; margin-top: 6px; }
.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.purple { color: var(--purple); }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-in_progress { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-completed { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-cancelled { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-trial { background: rgba(139, 92, 246, 0.15); color: var(--purple); }
.badge-active { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-expired { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ===== Tables ===== */
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ===== Flash messages ===== */
.flash-container { margin-bottom: 16px; }
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}
.flash-success { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--success); }
.flash-error { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.3); color: var(--danger); }
.flash-info { background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(59, 130, 246, 0.3); color: var(--info); }

/* ===== Layout: App Shell (mobile-first) ===== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.app-header .logo { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.app-header .logo .dot { color: var(--primary); }

.app-main { flex: 1; padding: 16px; max-width: 900px; width: 100%; margin: 0 auto; }

/* Bottom nav (mobile) */
.bottom-nav {
    position: sticky;
    bottom: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    padding: 6px 4px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    z-index: 100;
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    font-size: 11px;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a:hover { color: var(--primary); background: var(--primary-soft); }
.bottom-nav .nav-icon { font-size: 20px; line-height: 1; }

/* ===== Sidebar (desktop web version) ===== */
@media (min-width: 1024px) {
    .app-shell.desktop { flex-direction: row; }
    .app-shell.desktop .app-sidebar {
        width: 240px;
        min-height: 100vh;
        position: sticky;
        top: 0;
        background: var(--bg-secondary);
        border-right: 1px solid var(--border);
        padding: 20px 14px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .app-shell.desktop .app-sidebar .logo { padding: 0 10px; margin-bottom: 20px; }
    .app-shell.desktop .app-sidebar a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: var(--radius-sm);
        color: var(--text-secondary);
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s;
    }
    .app-shell.desktop .app-sidebar a:hover { background: var(--bg-card); color: var(--text); }
    .app-shell.desktop .app-sidebar a.active { background: var(--primary-soft); color: var(--primary); }
    .app-shell.desktop .app-main { padding: 24px 32px; max-width: 1100px; }
    .app-shell.desktop .bottom-nav { display: none; }
}

/* ===== Landing ===== */
.landing { min-height: 100vh; }
.landing-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 21, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.landing-nav .logo { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.landing-nav .logo .dot { color: var(--primary); }
.landing-nav .nav-links { display: flex; gap: 8px; align-items: center; }

.hero {
    text-align: center;
    padding: 80px 24px 60px;
    max-width: 800px;
    margin: 0 auto;
}
.hero .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 24px;
}
.hero h1 {
    font-size: clamp(32px, 6vw, 52px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -1px;
}
.hero h1 .gradient {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero p { font-size: 18px; color: var(--text-secondary); margin-bottom: 32px; max-width: 600px; margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.features-section { padding: 60px 24px; max-width: 1100px; margin: 0 auto; }
.section-title { text-align: center; font-size: 32px; font-weight: 800; margin-bottom: 12px; }
.section-subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 44px; font-size: 16px; }

.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: all 0.3s;
}
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--primary);
}
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-secondary); }

/* Pricing */
.pricing-section { padding: 60px 24px; max-width: 1100px; margin: 0 auto; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.pricing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    transition: all 0.3s;
    position: relative;
}
.pricing-card.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.pricing-card .plan-name { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.pricing-card .plan-price { font-size: 40px; font-weight: 800; margin-bottom: 4px; }
.pricing-card .plan-price span { font-size: 16px; color: var(--text-muted); font-weight: 500; }
.pricing-card .plan-period { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.pricing-card .plan-features { list-style: none; text-align: left; margin-bottom: 24px; }
.pricing-card .plan-features li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-secondary); }
.pricing-card .plan-features li:last-child { border-bottom: none; }
.pricing-card .plan-features li::before { content: '✓'; color: var(--success); margin-right: 10px; font-weight: 700; }

/* CTA */
.cta-section { padding: 80px 24px; text-align: center; }
.cta-section h2 { font-size: 32px; font-weight: 800; margin-bottom: 16px; }
.cta-section p { color: var(--text-secondary); font-size: 17px; margin-bottom: 28px; }

.landing-footer { border-top: 1px solid var(--border); padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ===== Auth pages ===== */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow);
}
.auth-card .auth-logo { text-align: center; font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.auth-card .auth-logo .dot { color: var(--primary); }
.auth-card .auth-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.auth-card .auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-secondary); }

/* ===== Order create ===== */
.service-select {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.service-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.service-option:hover { border-color: var(--border-hover); }
.service-option.selected { border-color: var(--primary); background: var(--primary-soft); }
.service-option .service-name { font-weight: 600; }
.service-option .service-price { color: var(--primary); font-weight: 700; }
.service-option input { display: none; }

.order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 16px;
}

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 6px; }

/* ===== Utility ===== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 18px; }
.text-bold { font-weight: 700; }
.text-center { text-align: center; }
.d-none { display: none; }

/* ===== Admin layout ===== */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.admin-sidebar .logo { padding: 0 10px; margin-bottom: 20px; font-size: 18px; font-weight: 800; }
.admin-sidebar .logo .dot { color: var(--primary); }
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.admin-sidebar a:hover { background: var(--bg-card); color: var(--text); }
.admin-sidebar a.active { background: var(--primary-soft); color: var(--primary); }
.admin-main { flex: 1; padding: 24px 32px; max-width: 1200px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-header h1 { font-size: 24px; font-weight: 800; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive */
@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .auth-card { padding: 24px; }
    .landing-nav { padding: 12px 16px; }
    .landing-nav .nav-links .btn { padding: 8px 14px; font-size: 13px; }
    .hero { padding: 60px 20px 40px; }
    .hero p { font-size: 16px; }
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; height: auto; position: static; flex-direction: row; overflow-x: auto; padding: 10px; }
    .admin-sidebar .logo { display: none; }
    .admin-sidebar a { white-space: nowrap; }
    .admin-main { padding: 16px; }
}
