/* ============ NP iPhones — Store Stylesheet ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --ink: #111827;
    --muted: #6b7280;
    --brand: #0071e3;
    --brand-dark: #005bb8;
    --green: #0f9d58;
    --line: #e5e7eb;
    --radius: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    padding-bottom: 90px; /* space for sticky buy bar */
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 18px; }

/* ---------- Header ---------- */
.site-header {
    background: #0b0f19;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.site-header .inner {
    max-width: 1100px; margin: 0 auto; padding: 14px 18px;
    display: flex; align-items: center; justify-content: space-between;
}
.site-header .logo { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.site-header .logo span { color: #4cc2ff; }
.site-header nav a {
    color: #cbd5e1; margin-left: 22px; font-size: 14px; font-weight: 600;
}
.site-header nav a:hover { color: #fff; }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, #0b0f19 0%, #1b2a4a 60%, #0071e3 130%);
    color: #fff;
    padding: 60px 0 70px;
    text-align: center;
}
.hero h1 { font-size: 40px; margin-bottom: 12px; }
.hero p { color: #b6c2d6; font-size: 17px; max-width: 620px; margin: 0 auto 24px; }
.hero .tag {
    display: inline-block; background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.25);
    padding: 6px 16px; border-radius: 999px; font-size: 13px; margin-bottom: 18px;
    color: #dbeafe;
}
.hero .btn {
    display: inline-block; background: #fff; color: #0b0f19;
    padding: 12px 30px; border-radius: 999px; font-weight: 700; font-size: 15px;
}
.hero .btn:hover { background: #dbeafe; }

/* ---------- Sections ---------- */
.section { padding: 40px 0 10px; }
.section h2 { font-size: 24px; margin-bottom: 6px; }
.section .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
/* ---------- Product grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    transition: transform .18s, box-shadow .18s;
    display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(0,0,0,.10); }
.card .thumb {
    position: relative; aspect-ratio: 1/1; background: #eceef1; overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .badge {
    position: absolute; top: 10px; left: 10px;
    background: #0f9d58; color: #fff; font-size: 11px; font-weight: 700;
    padding: 4px 10px; border-radius: 999px;
}
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .price { font-size: 19px; font-weight: 800; color: var(--brand); margin-top: auto; padding-top: 8px; }
.card .img-count { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 3px 9px; border-radius: 999px; }

/* ---------- Product detail page ---------- */
.detail-wrap {
    display: grid; grid-template-columns: 1fr 1fr; gap: 36px;
    padding: 36px 0 20px;
}
.gallery .main-img {
    border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
    background: #eceef1; aspect-ratio: 1/1;
}
.gallery .main-img img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumbs img {
    width: 68px; height: 68px; object-fit: cover; border-radius: 10px;
    border: 2px solid transparent; cursor: pointer; opacity: .75;
}
.thumbs img:hover { opacity: 1; }
.thumbs img.active { border-color: var(--brand); opacity: 1; }

.detail-info h1 { font-size: 28px; margin-bottom: 10px; }
.detail-info .price-big { font-size: 30px; font-weight: 800; color: var(--brand); margin: 6px 0 14px; }
.condition-chip {
    display: inline-block; background: #e7f6ef; color: #0b7a44;
    font-size: 13px; font-weight: 700; padding: 5px 14px; border-radius: 999px; margin-bottom: 14px;
}
.spec-table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.spec-table td { padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.spec-table td:first-child { color: var(--muted); width: 40%; }
.desc { color: #374151; font-size: 15px; line-height: 1.65; }
.back-link { display: inline-block; margin-top: 26px; color: var(--brand); font-weight: 600; font-size: 14px; }
/* ---------- Sticky bottom buy bar ---------- */
.sticky-buy {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -6px 22px rgba(0,0,0,.12);
    padding: 12px 0;
}
.sticky-buy .inner {
    max-width: 1100px; margin: 0 auto; padding: 0 18px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.sticky-buy .p-name { font-weight: 700; font-size: 15px; }
.sticky-buy .p-price { font-size: 20px; font-weight: 800; color: var(--brand); }
.btn-buy {
    background: linear-gradient(135deg, #0f9d58, #0b7a44);
    color: #fff; border: none; cursor: pointer;
    font-size: 16px; font-weight: 800;
    padding: 14px 34px; border-radius: 999px;
}
.btn-buy:hover { filter: brightness(1.08); }
.cod-note { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Order modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(10,12,20,.6);
    display: none; align-items: center; justify-content: center; z-index: 200;
    padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: #fff; border-radius: 18px; max-width: 460px; width: 100%;
    padding: 26px; max-height: 92vh; overflow: auto;
}
.modal h2 { font-size: 20px; margin-bottom: 4px; }
.modal .m-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.modal .order-summary {
    background: #f3f4f6; border-radius: 10px; padding: 10px 14px;
    font-size: 13px; margin-bottom: 18px; color: #374151;
}
.modal .order-summary b { font-size: 15px; color: var(--brand); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field input, .field textarea, .field select {
    width: 100%; padding: 11px 12px; border: 1px solid var(--line);
    border-radius: 10px; font-size: 14px; font-family: inherit; background: #fff;
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
.field textarea { resize: vertical; min-height: 72px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn-secondary {
    background: #e5e7eb; color: #111827; border: none; padding: 12px 20px;
    border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.btn-submit {
    background: linear-gradient(135deg, #0f9d58, #0b7a44); color: #fff; border: none;
    padding: 12px 20px; border-radius: 999px; font-weight: 800; font-size: 14px;
    cursor: pointer; flex: 1;
}
/* ---------- Alerts & success page ---------- */
.alert { padding: 14px 18px; border-radius: 12px; margin: 18px 0; font-size: 14px; font-weight: 600; }
.alert.success { background: #e7f6ef; color: #0b7a44; }
.alert.error { background: #fde8e8; color: #b91c1c; }

.success-box {
    background: #fff; max-width: 520px; margin: 60px auto;
    border-radius: 18px; padding: 44px 36px; text-align: center;
    border: 1px solid var(--line);
}
.success-box .tick {
    width: 70px; height: 70px; border-radius: 50%;
    background: #e7f6ef; color: #0f9d58; font-size: 34px;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 18px;
}
.success-box h1 { font-size: 24px; margin-bottom: 8px; }
.success-box p { color: var(--muted); font-size: 15px; margin-bottom: 6px; }
.success-box .btn { display: inline-block; margin-top: 22px; background: var(--brand); color: #fff; padding: 12px 28px; border-radius: 999px; font-weight: 700; }

/* ---------- Admin ---------- */
.admin-header { background: #0b0f19; color: #fff; padding: 14px 0; }
.admin-header .inner {
    max-width: 1100px; margin: 0 auto; padding: 0 18px;
    display: flex; align-items: center; justify-content: space-between;
}
.admin-header a { color: #cbd5e1; margin-left: 18px; font-size: 14px; font-weight: 600; }
.admin-header a:hover { color: #fff; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 24px 0; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat-card .num { font-size: 30px; font-weight: 800; color: var(--brand); }
.stat-card .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }

.admin-panel {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 26px; margin-bottom: 28px;
}
.admin-panel h2 { font-size: 20px; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .field.full { grid-column: 1 / -1; }
.file-hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.img-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.img-preview img { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
    text-align: left; padding: 10px 12px; background: #f9fafb;
    border-bottom: 2px solid var(--line); color: #374151; font-size: 12px;
    text-transform: uppercase; letter-spacing: .4px;
}
table.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #fafbfc; }
table.data img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; }
.btn-sm { border: none; cursor: pointer; font-size: 12px; font-weight: 700; padding: 7px 14px; border-radius: 999px; }
.btn-del { background: #fde8e8; color: #b91c1c; }
.btn-del:hover { background: #fbd5d5; }
.status-select {
    padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line);
    font-size: 13px; background: #fff; cursor: pointer;
}

.login-box {
    max-width: 380px; margin: 90px auto; background: #fff;
    border: 1px solid var(--line); border-radius: 18px; padding: 36px;
}
.login-box h1 { font-size: 22px; margin-bottom: 6px; }
.login-box .sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.btn-primary {
    background: var(--brand); color: #fff; border: none; width: 100%;
    padding: 12px; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn-primary:hover { background: var(--brand-dark); }

footer.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 0 110px; }

/* ---------- Responsive (phone-first) ---------- */
@media (max-width: 820px) {
    .detail-wrap { grid-template-columns: 1fr; gap: 22px; }
    .hero { padding: 42px 0 50px; }
    .hero h1 { font-size: 28px; }
    .hero p { font-size: 15px; }
    .form-grid { grid-template-columns: 1fr; }
    .site-header .inner { padding: 11px 14px; }
    .site-header .logo { font-size: 17px; }
    .site-header nav a { margin-left: 14px; font-size: 13px; }
    .sticky-buy .p-name { display: none; }
    .btn-buy { flex: 1; padding: 13px; }
}

@media (max-width: 600px) {
    body { padding-bottom: 84px; }

    /* header + hero compact */
    .site-header nav a { margin-left: 10px; font-size: 12.5px; }
    .hero h1 { font-size: 25px; }
    .hero .btn { padding: 11px 26px; font-size: 14px; }
    .hero .tag { font-size: 11px; padding: 5px 12px; }

    /* 2-column product grid like shopping apps */
    .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .section { padding: 26px 0 6px; }
    .section h2 { font-size: 20px; }
    .section .sub { font-size: 13px; margin-bottom: 16px; }
    .card .body { padding: 10px 12px 12px; gap: 3px; }
    .card h3 { font-size: 14px; }
    .card .meta { font-size: 12px; }
    .card .price { font-size: 16px; padding-top: 6px; }
    .card .badge { font-size: 10px; padding: 3px 8px; }
    .card .img-count { display: none; }

    /* product detail page */
    .detail-wrap { padding: 20px 0 10px; gap: 16px; }
    .detail-info h1 { font-size: 22px; }
    .detail-info .price-big { font-size: 26px; }
    .condition-chip { font-size: 12px; }
    .spec-table td { padding: 8px 4px; font-size: 13px; }
    .desc { font-size: 14px; }
    .thumbs { gap: 8px; }
    .thumbs img { width: 56px; height: 56px; }
    .back-link { margin-top: 20px; }

    /* sticky buy bar — price + full-width button */
    .sticky-buy { padding: 10px 0; }
    .sticky-buy .p-price { font-size: 18px; }
    .sticky-buy .cod-note { display: none; }
    .btn-buy { font-size: 15px; }

    /* order modal — mobile bottom-sheet style */
    .modal-overlay { padding: 12px; align-items: flex-end; }
    .modal { padding: 20px 18px; border-radius: 16px 16px 8px 8px; max-height: 88vh; }
    .modal h2 { font-size: 18px; }
    .field input, .field textarea, .field select { padding: 12px; font-size: 16px; } /* 16px = no zoom on iOS */
    .modal-actions { gap: 8px; }
    .btn-secondary, .btn-submit { padding: 12px 14px; }

    /* misc */
    .success-box { margin: 30px auto; padding: 30px 22px; }
    .success-box h1 { font-size: 20px; }
    footer.site-footer { padding: 26px 0 100px; font-size: 12px; }
    .alert { padding: 12px 14px; font-size: 13px; }
}
