/* ==========================================================
   Fameworld SMM Panel — User App Stylesheet
   Mobile-first, responsive up to desktop/tablet.
   ========================================================== */

:root {
    --primary: #6C5CE7;
    --primary-dark: #5849c2;
    --accent: #a78bfa;
    --bg-gradient-start: #e9e4f7;
    --bg-gradient-end: #f3e9f7;
    --text-dark: #241a3d;
    --text-muted: #6b6483;
    --card-bg: #ffffff;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --pending: #64748b;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 18px rgba(108, 92, 231, 0.12);
    --nav-height: 70px;
    --header-height: 64px;
}

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

body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(160deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-dark);
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 10px);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: transparent;
}

/* ---------------- Header ---------------- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(243, 233, 247, 0.85);
    backdrop-filter: blur(6px);
}

.brand-badge {
    background: #17141f;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.brand-badge .star { color: #fbbf24; }

.wallet-pill {
    background: #ffcd3c;
    color: #241a3d;
    font-weight: 700;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.back-btn {
    font-size: 20px;
    padding: 6px 10px;
    color: var(--text-dark);
}

.page-title {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    color: #3d2c73;
    padding: 6px 16px 16px;
}

/* ---------------- Cards ---------------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin: 0 16px 16px;
}

.list-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    margin: 0 16px 14px;
    font-weight: 700;
    font-size: 16px;
    color: #3d2c73;
    transition: transform .15s ease;
}
.list-tile:active { transform: scale(0.98); }

.list-tile .tile-left { display: flex; align-items: center; gap: 14px; }
.list-tile .icon-badge {
    width: 40px; height: 40px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    background: linear-gradient(135deg, #f3e9f7, #e9e4f7);
}
.list-tile .chev { color: var(--primary); font-size: 18px; }
.list-tile .price { font-weight: 700; color: var(--primary); font-size: 15px; }

/* ---------------- Section heading ---------------- */
.section-heading {
    font-size: 15px;
    font-weight: 700;
    color: #3d2c73;
    padding: 0 16px 10px;
    margin-top: 10px;
}

/* ---------------- Buttons ---------------- */
.btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 16px;
    border: none;
    cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: linear-gradient(135deg, #1f8f5f, #0f5132); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-block { margin: 16px; width: calc(100% - 32px); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; padding: 0 16px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: #3d2c73; }
.form-control {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid #ded4f2;
    border-radius: var(--radius-sm);
    font-size: 15px;
    background: #fff;
    color: var(--text-dark);
}
.form-control:focus { outline: none; border-color: var(--primary); }
.qty-error { color: #dc2626; font-size: 13px; font-weight: 600; margin-top: 6px; padding: 0 2px; }
.qty-error.hidden { display: none; }

/* ---------------- Auth screens ---------------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 32px 26px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.auth-card h1 { font-size: 24px; margin: 20px 0 24px; color: #241a3d; }
.auth-card .form-group { padding: 0; text-align: left; margin-bottom: 18px; }
.auth-switch { margin-top: 16px; font-size: 14px; color: var(--text-muted); }
.auth-switch a { color: var(--primary); font-weight: 700; }
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 16px;
    text-align: left;
}
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }

/* ---------------- Quantity list ---------------- */
.qty-tile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 15px 18px;
    margin: 0 16px 12px;
    font-weight: 700;
    color: #3d2c73;
    cursor: pointer;
    border: 2px solid transparent;
}
.qty-tile.selected { border-color: var(--primary); background: #f3effe; }
.qty-tile .price { color: var(--primary); }

/* ---------------- Order summary ---------------- */
.order-summary-box {
    margin: 0 16px 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: #dcfce7;
    border: 1.5px solid #86efac;
    color: #14532d;
    font-weight: 600;
}
.order-summary-box b { display: block; margin-bottom: 6px; font-size: 15px; }

/* Live price, shown directly under the quantity field as the user types */
.live-price {
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: #dcfce7;
    border: 1.5px solid #86efac;
    color: #14532d;
    font-weight: 600;
    font-size: 14px;
}
.live-price b { color: var(--primary); }

.service-details-box {
    margin: 0 16px 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: #fff;
    border: 2px solid #17141f;
    font-size: 13.5px;
    line-height: 2;
    color: #3d2c73;
}

/* ---------------- Orders list ---------------- */
.order-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin: 0 16px 14px;
}
.order-card .row { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 4px; color: var(--text-muted); }
.order-card .row strong { color: var(--text-dark); }
.order-card .order-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-card .order-id { font-weight: 800; color: #3d2c73; }

.status-badge {
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.status-pending { background: #e2e8f0; color: #475569; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-completed { background: #dcfce7; color: #166534; }
.status-partial { background: #fef3c7; color: #92400e; }
.status-failed, .status-cancelled { background: #fee2e2; color: #991b1b; }
.status-refunded { background: #ede9fe; color: #5b21b6; }

.filter-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 16px; }
.filter-chip {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    box-shadow: var(--shadow);
    white-space: nowrap;
}
.filter-chip.active { background: var(--primary); color: #fff; }

.search-bar {
    display: flex;
    gap: 8px;
    margin: 0 16px 16px;
}
.search-bar input {
    flex: 1;
    padding: 12px 14px;
    border-radius: 999px;
    border: none;
    box-shadow: var(--shadow);
    font-size: 14px;
}
.search-bar button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0 20px;
    border-radius: 999px;
    font-weight: 700;
}

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 42px; margin-bottom: 12px; }
.empty-state h3 { color: var(--text-dark); margin-bottom: 6px; }

/* ---------------- Stat tiles (profile) ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 16px 16px; }
.stat-tile { background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 16px 10px; text-align: center; }
.stat-tile .icon { font-size: 22px; margin-bottom: 8px; }
.stat-tile .label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.stat-tile .value { font-weight: 800; font-size: 15px; color: #3d2c73; }

.uid-box {
    display: flex; align-items: center; justify-content: space-between;
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 18px; margin: 0 16px 16px;
}
.uid-box .avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg,#f472b6,#a78bfa); display:flex; align-items:center; justify-content:center; color:#fff; font-size: 20px; }
.uid-box .uid-info { flex: 1; margin: 0 12px; }
.uid-box .uid-info small { display: block; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.uid-box .uid-info b { font-size: 16px; color: var(--primary); }
.copy-btn { background: #dcfce7; color: #166534; border: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; }

.menu-tile {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border-left: 4px solid var(--primary);
    border-radius: 12px; padding: 16px 18px; margin: 0 16px 12px;
    font-weight: 700; color: #241a3d; box-shadow: var(--shadow);
}
.menu-tile.highlight { background: #dcfce7; border-left-color: var(--success); }

/* ---------------- Bottom nav ---------------- */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 -4px 18px rgba(108,92,231,0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 14px;
    height: var(--nav-height);
    z-index: 100;
}
.bottom-nav .nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 11.5px; font-weight: 700; color: var(--text-muted);
    flex: 0 0 auto;
    min-width: 56px;
    text-align: center;
}
.bottom-nav .nav-item.active { color: var(--primary); }
.bottom-nav .nav-item i { font-size: 18px; }
.bottom-nav .nav-item.center {
    position: relative;
    top: -18px;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: center;
}
.bottom-nav .nav-item.center .fab-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 220px;
    padding: 14px 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, #7c6cf0, #6C5CE7);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(108,92,231,0.45);
    transition: transform .15s ease, box-shadow .15s ease;
}
.bottom-nav .nav-item.center .fab-pill i { font-size: 16px; }
.bottom-nav .nav-item.center:active .fab-pill { transform: scale(0.96); }

/* Small phones (<360px): drop the label, keep it a compact round button so
   "My Orders" / "Menu" never get squeezed off screen. */
@media (max-width: 359px) {
    .bottom-nav .nav-item.center .fab-pill {
        width: 56px; height: 56px; max-width: 56px;
        padding: 0; border-radius: 50%;
    }
    .bottom-nav .nav-item.center .fab-pill span.fab-label { display: none; }
}

.whatsapp-fab {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);
    right: max(16px, calc(50% - 240px + 16px));
    width: 52px; height: 52px;
    background: #25d366;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 24px;
    box-shadow: 0 6px 16px rgba(37,211,102,0.5);
    z-index: 90;
}
.whatsapp-fab .badge {
    position: absolute; top: -4px; right: -4px;
    background: #ef4444; color: #fff; font-size: 10px;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* ---------------- Loader ---------------- */
.loader-overlay {
    position: fixed; inset: 0; background: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 999; backdrop-filter: blur(2px);
}
.spinner {
    width: 40px; height: 40px; border-radius: 50%;
    border: 4px solid #e9e4f7; border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------------- Toast ---------------- */
.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);
    left: 50%; transform: translateX(-50%);
    background: #241a3d; color: #fff;
    padding: 12px 22px; border-radius: 999px;
    font-size: 14px; font-weight: 600;
    z-index: 999;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    animation: fadeInUp .25s ease;
}
@keyframes fadeInUp { from { opacity: 0; transform: translate(-50%, 10px);} to { opacity: 1; transform: translate(-50%, 0);} }

/* ---------------- Responsive: tablet & desktop ---------------- */
@media (min-width: 640px) {
    body { padding-bottom: 20px; }
    .app-shell {
        max-width: 900px;
        margin: 30px auto;
        border-radius: 28px;
        overflow: hidden;
        box-shadow: 0 20px 60px rgba(108,92,231,0.18);
        min-height: auto;
        background: linear-gradient(160deg, var(--bg-gradient-start), var(--bg-gradient-end));
    }
    .bottom-nav { max-width: 900px; position: sticky; bottom: 0; border-radius: 0 0 28px 28px; }
    .whatsapp-fab { right: calc(50% - 450px + 24px); }

    .services-grid, .tiles-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0 16px;
        padding: 0 16px;
    }
    .services-grid .list-tile, .tiles-grid .list-tile { margin: 0 0 14px; }
    .stat-grid { max-width: 500px; }
}

@media (min-width: 1024px) {
    .app-shell { max-width: 1100px; }
    .bottom-nav { max-width: 1100px; }
    .services-grid, .tiles-grid { grid-template-columns: repeat(3, 1fr); }
}
