:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --primary-light: #fff7ed;
    --primary-50: #fff0e6;
    --accent-green: #10b981;
    --accent-green-lt: #d1fae5;
    --dark: #111827;
    --body-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.09);
}

html {
    scroll-behavior: smooth;
    /* Prevent iOS font-size inflation */
    -webkit-text-size-adjust: 100%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: "Be Vietnam Pro", sans-serif;
    background: var(--body-bg);
    color: var(--dark);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    /* Prevent horizontal overflow on mobile */
    overflow-x: hidden;
}

.rh-navbar {
    background: #fff;
    border-bottom: 1.5px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 999;
    padding: 0.65rem 0;
}

.rh-brand {
    font-weight: 900;
    letter-spacing: -0.3px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
}

.rh-logo {
    height: 55px;
    margin-top: -0.825rem;
    margin-bottom: -0.825rem;
    object-fit: contain;
    flex-shrink: 0;
}

.rh-brand-name {
    display: none;
    color: var(--dark);
}

.rh-brand-name em {
    color: var(--primary);
    font-style: normal;
}

.rh-nav-link {
    color: var(--primary) !important;
    font-weight: 600;
    font-size: 0.89rem;
    border-radius: 0.4rem;
    padding: 0.3rem 0.6rem !important;
    transition: background 0.15s ease;
}

.rh-nav-link:hover {
    background: var(--primary-50);
}

.rh-nav-link.active {
    background: var(--primary-50);
}

.btn-rh-primary {
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
    padding: 0.5rem 1.2rem;
    font-size: 0.87rem;
    /* Improve tap responsiveness on mobile */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 0.15s ease,
        transform 0.1s ease;
}

.btn-rh-primary:hover {
    background: var(--primary-dark);
    color: #fff;
    transform: translateY(-1px);
}

.btn-rh-outline {
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--dark);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.87rem;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.15s ease;
}

.btn-rh-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.rh-card {
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.rh-page-title {
    font-size: clamp(1.6rem, 3.2vw, 2.3rem);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.35px;
    text-wrap: balance;
}

.rh-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.rh-stat-number {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
    margin-bottom: 0.35rem;
}

.rh-feature-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1.5px solid var(--border);
    border-radius: 0.8rem;
    padding: 0.75rem 0.9rem;
    background: #fff;
    font-weight: 600;
}

.rh-feature-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--primary-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.rh-section {
    padding: 1rem 0 1.5rem;
}

.rh-foot {
    background: #111827;
    color: #9ca3af;
}

.rh-foot a {
    color: #fff;
    opacity: 0.9;
}

.table {
    --bs-table-bg: transparent;
}

.table > :not(caption) > * > * {
    padding: 0.68rem 0.8rem;
    vertical-align: middle;
    font-size: 0.86rem;
}

.table > thead {
    --bs-table-bg: var(--primary);
    --bs-table-color: #fff;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: #fffbf5;
}

.form-control,
.form-select {
    border: 1.5px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    background: #fafafa;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
    background: #fff;
}

.auth-layout {
    /* Use dvh for accurate mobile viewport height (excludes browser chrome) */
    min-height: calc(100dvh - 140px);
    display: flex;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
}

.auth-banner {
    flex: 0 0 38%;
    background: linear-gradient(135deg, var(--primary), #f59e0b);
    color: #fff;
    padding: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.auth-banner h3 {
    font-weight: 900;
}

.auth-panel {
    flex: 1;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-panel .rh-card {
    width: 100%;
    max-width: 440px;
}

@media (max-width: 991px) {
    .auth-layout {
        min-height: auto;
    }

    .auth-banner {
        display: none;
    }

    .auth-panel {
        padding: 1.2rem;
    }
}

.home-hero {
    background: linear-gradient(135deg, #fff8f3 0%, #fef3c7 100%);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4.1rem 1.2rem 3.6rem;
    text-align: center;
}

.home-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    padding: 0.3rem 0.8rem;
    font-size: 0.79rem;
    font-weight: 700;
}

.home-kicker .dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--primary);
}

.home-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    letter-spacing: -0.4px;
    line-height: 1.16;
}

.home-pill {
    background: #fff;
    border: 1.5px solid var(--border);
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.home-mini-stats {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.home-camp-cover {
    height: 132px;
    background: linear-gradient(135deg, var(--primary-50), var(--primary-light));
    font-size: 2.2rem;
}

.platform-tile {
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    border: 1.5px solid var(--border);
    background: #fff;
    height: 100%;
}

.platform-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    background: var(--primary-50);
    color: var(--primary);
}

.benefit-grid-item {
    border: 1.5px solid var(--border);
    border-radius: 0.8rem;
    padding: 0.75rem 0.85rem;
    background: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 0.8rem;
    position: relative;
}

.step-icon span {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-orange {
    background: var(--primary-50);
}

.step-orange span {
    background: var(--primary);
}

.step-yellow {
    background: #fffbeb;
}

.step-yellow span {
    background: #f59e0b;
}

.step-green {
    background: #d1fae5;
}

.step-green span {
    background: var(--accent-green);
}

/* ─── Mobile optimizations ─────────────────────────────────────── */
@media (max-width: 767.98px) {
    /* Increase container padding on mobile for better spacing */
    .container,
    .container-fluid,
    main.container {
        --bs-gutter-x: 1rem;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Fix iOS auto-zoom: inputs must be 16px+ to prevent zoom-on-focus */
    .form-control,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
        min-height: 44px; /* Minimum touch target */
    }

    /* Proper mobile navbar spacing */
    .rh-navbar {
        padding: 0.5rem 0;
    }

    .rh-navbar .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Ensure collapse menu has comfortable spacing */
    .navbar-collapse .navbar-nav {
        padding: 0.5rem 0;
        gap: 0.15rem;
    }

    .rh-nav-link {
        padding: 0.5rem 0.6rem !important;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Button touch targets on mobile */
    .btn-rh-primary,
    .btn-rh-outline {
        min-height: 44px;
        padding: 0.6rem 1.2rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Auth layout on mobile */
    .auth-panel {
        padding: 1rem;
    }

    /* Table horizontal scroll on mobile */
    .table-responsive-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── TikTok Shop pages: tighten oversized desktop padding on phones ── */
    .tts-hero { padding: 18px 16px !important; margin-bottom: 16px; border-radius: 12px; }
    .tts-hero h1 { font-size: 1.25rem; }
    .tts-hero p { font-size: .82rem; }
    /* Developer-API button is absolutely positioned in the hero corner;
       on phones it overlaps the title, so let it sit in normal flow. */
    .tts-hero .btn-light.position-absolute { position: static !important; display: inline-flex; margin-top: 12px; }
    .collab-hero,
    .gen-hero,
    .dev-hero { padding: 18px 16px !important; margin-bottom: 16px; }
    .collab-hero h1,
    .gen-hero h1,
    .dev-hero h1 { font-size: 1.2rem; }

    .tts-card,
    .collab-card,
    .gen-card,
    .form-section,
    .rtd-card { padding: 14px !important; }
    .rtd-kpi { padding: 14px !important; }
    .not-connected-notice { padding: 22px 16px !important; }

    /* KPI + product grids: tighter gaps, ensure 2 columns fit on narrow phones */
    .rtd-kpis { gap: 10px; margin-bottom: 14px; }
    .rtd-grid { gap: 14px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ─── Tablet-specific fixes ────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 991.98px) {
    .auth-panel {
        padding: 1.5rem;
    }
}

/* ─── Notification Bell ────────────────────────────────────────── */
.btn-rh-icon {
    background: transparent;
    border: none;
    padding: 0.4rem 0.6rem;
    font-size: 1.25rem;
    color: var(--rh-navy);
    position: relative;
    transition: color 0.15s;
}
.btn-rh-icon:hover {
    color: var(--rh-orange);
}
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 99px;
    padding: 0 4px;
}
.notif-badge.pulse {
    animation: notif-pulse 0.6s ease-out;
}
@keyframes notif-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
