/* ==========================================================================
   Krativora Marketplace — Public Stylesheet
   Brand: #FF8A00 (orange) -> #F53B30 (red) -> #7A3FF2 (purple) -> #1976F3 (blue)
   ========================================================================== */

:root {
    --c-blue: #1976F3;
    --c-purple: #7A3FF2;
    --c-pink: #F53B30;
    --c-orange: #FF8A00;
    --c-ink: #0F1222;
    --c-ink-soft: #4A4E63;
    --c-muted: #767C93;
    --c-bg: #F7F8FC;
    --c-card: #FFFFFF;
    --c-border: #C7CCDA;      /* card/panel boundaries — deliberately visible */
    --c-border-soft: #E9EBF1; /* internal dividers (table rows, list separators) — quieter */
    --gradient-brand: linear-gradient(90deg, var(--c-orange), var(--c-pink), var(--c-purple), var(--c-blue));
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-card: 0 1px 2px rgba(15, 18, 34, 0.04);
    --shadow-hover: 0 12px 28px rgba(25, 118, 243, 0.16);
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--c-bg);
    color: var(--c-ink);
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn-primary {
    background: var(--gradient-brand);
    background-size: 200% auto;
    color: #fff;
    box-shadow: var(--shadow-hover);
}
.btn-primary:hover { background-position: right center; transform: translateY(-1px); }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--c-border);
    color: var(--c-ink);
}
.btn-outline:hover { border-color: var(--c-blue); color: var(--c-blue); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    gap: 24px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.4rem; }
.logo img { height: 34px; width: auto; }
.logo .brand-a { background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }

.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a { font-weight: 500; color: var(--c-ink-soft); font-size: 0.95rem; }
.main-nav a:hover { color: var(--c-blue); }

.header-search {
    flex: 1;
    max-width: 420px;
    position: relative;
}
.header-search input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border-radius: 999px;
    border: 1.5px solid var(--c-border);
    background: var(--c-bg);
    font-size: 0.9rem;
}
.header-search input:focus { outline: none; border-color: var(--c-blue); background: #fff; }
.header-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: 0.5; }

.header-actions { display: flex; align-items: center; gap: 16px; }
.icon-btn {
    position: relative;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--c-bg);
}
.icon-btn .badge {
    position: absolute; top: -4px; right: -4px;
    background: var(--c-pink); color: #fff;
    font-size: 0.65rem; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, rgba(25,118,243,0.06), rgba(245,59,48,0.06));
    padding: 72px 0;
    text-align: center;
}
.hero h1 { font-size: 2.75rem; font-weight: 800; margin: 0 0 16px; letter-spacing: -0.02em; }
.hero h1 .accent { background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 1.1rem; color: var(--c-ink-soft); max-width: 560px; margin: 0 auto 32px; }

/* ---------- Category chips ---------- */
.cat-strip { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }
.cat-chip {
    display: flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--c-border);
    padding: 10px 18px; border-radius: 999px;
    font-weight: 600; font-size: 0.88rem;
}
.cat-chip:hover { border-color: var(--c-purple); color: var(--c-purple); }

/* ---------- Grid & Cards ---------- */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 28px; }
.section-head h2, .section-head h1 { font-size: 1.6rem; margin: 0; }
.section-head a { font-weight: 600; color: var(--c-blue); font-size: 0.9rem; }

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

.card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.card-thumb { aspect-ratio: 4/3; background: var(--c-bg); overflow: hidden; position: relative; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-badge {
    position: absolute; top: 10px; left: 10px;
    background: var(--gradient-brand); color: #fff;
    font-size: 0.7rem; font-weight: 700;
    padding: 4px 10px; border-radius: 999px;
}
.card-body { padding: 16px; }
.card-cat { font-size: 0.75rem; font-weight: 600; color: var(--c-purple); text-transform: uppercase; letter-spacing: 0.03em; }
.card-title { font-size: 1rem; font-weight: 700; margin: 6px 0; }
.card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.card-price { font-weight: 800; font-size: 1.05rem; }
.card-price .was { text-decoration: line-through; color: #9aa0b4; font-weight: 500; font-size: 0.85rem; margin-right: 6px; }
.card-rating { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--c-ink-soft); }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-ink); color: #cfd2e6; padding: 56px 0 24px; margin-top: 64px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid h4 { color: #fff; font-size: 0.95rem; margin: 0 0 14px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 10px; }
.footer-grid a { color: #aeb2cc; font-size: 0.9rem; }
.footer-grid a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 40px; padding-top: 20px;
    display: flex; justify-content: space-between; font-size: 0.85rem; color: #8b8fb0;
}

/* ---------- Sidebar nav (account & merchant dashboards) ---------- */
.sidebar-nav { padding: 10px; }
.sidebar-nav a {
    display: block;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.89rem;
    color: var(--c-ink-soft);
    margin-bottom: 1px;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar-nav a:hover { background: var(--c-bg); color: var(--c-ink); }
.sidebar-nav a.active {
    background: rgba(25, 118, 243, 0.07);
    color: var(--c-blue);
    border-left-color: var(--c-blue);
    font-weight: 700;
}
.sidebar-nav a.active:hover { background: rgba(25, 118, 243, 0.1); color: var(--c-blue); }
.sidebar-nav .sidebar-divider {
    border-top: 1px solid var(--c-border-soft);
    margin: 10px 6px;
    padding-top: 10px;
}
.sidebar-profile {
    padding: 16px 18px 18px;
    margin: -10px -10px 8px;
    border-bottom: 1px solid var(--c-border-soft);
}
.sidebar-profile .name { font-weight: 700; font-size: 0.98rem; }
.sidebar-profile .meta { font-size: 0.8rem; color: var(--c-muted); margin-top: 3px; }

/* ---------- Panels & Cards (account, merchant, cart, checkout dashboards) ----------
   Flat cards: the border defines the edge, a near-invisible shadow adds just
   a hair of lift. Deliberately NOT stacking a heavy shadow on top of a heavy
   border — that combination is what read as "busy" rather than clean. */
.panel {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 26px 28px;
    margin-bottom: 20px;
}
.panel:last-child { margin-bottom: 0; }
.panel h3, .panel h4 { margin-top: 0; }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--c-border-soft);
}
.panel-head h2, .panel-head h3 { margin: 0; }

/* ---------- Chart container ---------- */
.chart-wrap { position: relative; height: 260px; }
.chart-wrap.chart-sm { height: 160px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid var(--c-border); border-radius: var(--radius-sm);
    font-size: 0.95rem; background: #fff; color: var(--c-ink);
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:hover { border-color: #aab0c4; }
.form-control:focus { outline: none; border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(25, 118, 243, 0.12); }
select.form-control {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A4E63' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}
textarea.form-control { resize: vertical; min-height: 90px; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; margin-bottom: 18px; }
.alert-success { background: #e7f8ee; color: #146c3f; }
.alert-error { background: #fdecec; color: #b3261e; }
.alert-info { background: #eaf1fd; color: #1d4ed8; }

/* ---------- Tables (account pages) ---------- */
table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th {
    text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
    color: var(--c-muted); padding: 10px 14px; border-bottom: 1.5px solid var(--c-border);
}
.admin-table td { padding: 14px; border-bottom: 1px solid var(--c-border-soft); vertical-align: middle; }
.admin-table tr:hover td { background: var(--c-bg); }

.badge {
    display: inline-block; padding: 4px 10px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700;
}
.badge-success { background: #e7f8ee; color: #147a4d; }
.badge-warning { background: #fff4e0; color: #a3610a; }
.badge-danger { background: #fdecec; color: #b3261e; }
.badge-info { background: #eaf1fd; color: #1d4ed8; }
.badge-muted { background: #eef0f6; color: #5a5e73; }

/* ---------- Preloader ---------- */
.preloader {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: #fff;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.preloader.preloader-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-mark {
    position: relative;
    width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
}
.preloader-mark img { width: 34px; height: 34px; }
.preloader-ring {
    position: absolute; inset: 0;
    border-radius: 50%;
    border: 3px solid var(--c-border-soft, #E9EBF1);
    border-top-color: var(--c-blue);
    border-right-color: var(--c-purple);
    animation: preloader-spin 0.85s linear infinite;
}
@keyframes preloader-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .preloader-ring { animation: none; }
}

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }

/* ---------- Responsive layout utilities ----------
   Used in place of inline grid-template-columns so media queries can
   actually override them (inline styles can't be beaten by @media). */
.layout-sidebar-left {   /* filters sidebar + content, e.g. templates.php */
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
    align-items: start;
}
.layout-account {   /* account nav + content, e.g. account/*.php */
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
}
.layout-detail {   /* template-detail.php gallery/description + buy box */
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 36px;
    align-items: start;
}
.layout-cart {   /* cart.php items + summary */
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    align-items: start;
}
.layout-checkout {   /* checkout.php billing + payment */
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
    align-items: start;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.stat-card .stat-icon {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(25, 118, 243, 0.1); color: var(--c-blue);
}
.stat-card .stat-icon.orange { background: rgba(255, 138, 0, 0.13); color: #a85e00; }
.stat-card .stat-icon.green  { background: rgba(20, 122, 77, 0.1); color: #147a4d; }
.stat-card .stat-icon.purple { background: rgba(122, 63, 242, 0.1); color: var(--c-purple); }
.stat-card .stat-icon.red    { background: rgba(245, 59, 48, 0.1); color: #c22b2b; }
.stat-card .stat-body { flex: 1; min-width: 0; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--c-muted); font-weight: 600; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 800; margin-top: 3px; color: var(--c-ink); line-height: 1.2; }
.stat-card .stat-delta { font-size: 0.76rem; margin-top: 4px; font-weight: 600; }
.stat-card .stat-delta.up { color: #147a4d; }
.stat-card .stat-delta.down { color: #c22b2b; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Mobile nav toggle ---------- */
.nav-toggle {
    display: none;
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    border-radius: 8px; border: 1.5px solid var(--c-border);
    background: #fff; cursor: pointer;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
    display: block; width: 18px; height: 2px; background: var(--c-ink); position: relative; transition: 0.2s;
}
.nav-toggle span::before { content: ''; position: absolute; top: -6px; width: 18px; height: 2px; background: var(--c-ink); }
.nav-toggle span::after { content: ''; position: absolute; top: 6px; width: 18px; height: 2px; background: var(--c-ink); }

.mobile-panel {
    display: none;
    background: #fff;
    border-bottom: 1px solid var(--c-border);
    padding: 16px 24px 20px;
}
.mobile-panel.open { display: block; }
.mobile-panel .main-nav { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.mobile-panel .main-nav a { padding: 10px 0; width: 100%; border-bottom: 1px solid var(--c-border); }
.mobile-panel .header-search { display: flex; max-width: none; margin-top: 12px; }
.mobile-panel .header-actions { margin-top: 16px; display: flex; gap: 10px; }
@media (max-width: 900px) {
    .site-header .header-inner { height: 64px; }
    .main-nav, .header-search { display: none; }
    .nav-toggle { display: flex; }
    .logo span.logo-text { display: none; }

    .layout-sidebar-left,
    .layout-account,
    .layout-detail,
    .layout-cart,
    .layout-checkout {
        grid-template-columns: 1fr !important;
    }
    .layout-account aside,
    .layout-sidebar-left aside,
    .buy-box {
        position: static !important;
    }

    .hero h1 { font-size: 2rem; }
    .hero { padding: 48px 0; }
    .section { padding: 36px 0; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-bottom { flex-direction: column; gap: 6px; text-align: center; }
}

@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.6rem; }
    .card-title { font-size: 0.92rem; }
    .footer-grid { grid-template-columns: 1fr; }
    .panel { padding: 18px !important; }
    table.admin-table { display: block; overflow-x: auto; white-space: nowrap; font-size: 0.82rem; }
    .admin-table th, .admin-table td { padding: 8px; }
}
