/* ============================================================
   Faris Alfursan — Main Stylesheet
   ============================================================ */

:root {
    --green-900: #0b3d2e;
    --green-800: #0f5132;
    --green-700: #146c43;
    --green-600: #198754;
    --green-100: #e7f4ec;
    --gold: #d4a017;
    --gold-light: #f3e5b8;
    --cream: #f8f7f2;
    --ink: #1f2937;
    --ink-soft: #6b7280;
    --line: #e5e7eb;
    --danger: #b91c1c;
    --danger-bg: #fde8e8;
    --white: #ffffff;
    --radius: 10px;
    --shadow: 0 2px 10px rgba(11, 61, 46, 0.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--cream);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

.main-content { flex: 1 0 auto; padding-top: 24px; padding-bottom: 48px; }

/* ---------- Header ---------- */
.site-header {
    background: var(--green-900);
    color: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 62px;
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--white);
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--gold-light); }
.logo-mark { font-size: 1.4rem; }

.main-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1;
}

.main-nav a {
    color: var(--white);
    font-size: 0.95rem;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
}
.main-nav a:hover {
    color: var(--gold-light);
    text-decoration: none;
    border-bottom-color: var(--gold);
}

.nav-user { color: var(--gold-light); font-size: 0.9rem; }
.nav-user small { opacity: 0.8; text-transform: capitalize; }

.cart-link {
    background: var(--gold);
    color: var(--green-900);
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cart-link:hover { background: var(--gold-light); text-decoration: none; }

.cart-count {
    background: var(--green-900);
    color: var(--white);
    border-radius: 999px;
    font-size: 0.75rem;
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    border: 1px solid transparent;
    font-size: 0.95rem;
}
.alert-success { background: var(--green-100); border-color: #b7e0c6; color: var(--green-800); }
.alert-error, .alert-danger { background: var(--danger-bg); border-color: #f3b7b7; color: var(--danger); }
.alert-warning { background: #fdf6e3; border-color: #f0df9b; color: #8a6d1a; }
.alert-info { background: #e8f1fb; border-color: #bcd7f3; color: #1c528b; }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(135deg, var(--green-800), var(--green-600));
    color: var(--white);
    border-radius: 16px;
    padding: 42px 34px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}
.hero h1 { margin: 0 0 8px; font-size: 2rem; }
.hero p { margin: 0 0 18px; opacity: 0.92; max-width: 560px; }
.hero .hero-emoji {
    position: absolute;
    right: 26px;
    bottom: -12px;
    font-size: 6rem;
    opacity: 0.18;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    background: var(--green-700);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s ease;
}
.btn:hover { background: var(--green-800); color: var(--white); text-decoration: none; }

.btn-gold { background: var(--gold); color: var(--green-900); }
.btn-gold:hover { background: #b8890f; color: var(--green-900); }

.btn-outline {
    background: transparent;
    color: var(--green-700);
    border: 1.5px solid var(--green-700);
}
.btn-outline:hover { background: var(--green-700); color: var(--white); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; }

/* ---------- Section headings ---------- */
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 26px 0 16px;
    flex-wrap: wrap;
}
.section-head h2 { margin: 0; font-size: 1.4rem; color: var(--green-900); }

/* ---------- Product grid ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}

.product-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(11, 61, 46, 0.14); }

.product-img {
    height: 170px;
    background: var(--green-100);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.img-placeholder { font-size: 3.4rem; opacity: 0.65; }

.product-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.product-body h3 { margin: 0; font-size: 1.02rem; }
.product-body h3 a { color: var(--ink); }
.product-details {
    color: var(--ink-soft);
    font-size: 0.87rem;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}
.price { font-size: 1.15rem; font-weight: 700; color: var(--green-800); }
.stock { font-size: 0.78rem; color: var(--ink-soft); }
.stock.out { color: var(--danger); font-weight: 600; }

.add-row { display: flex; gap: 8px; }
.add-row .btn { flex: 1; }

/* ---------- Product detail ---------- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 28px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 26px;
    box-shadow: var(--shadow);
}
.product-detail .product-img { height: 340px; border-radius: 10px; }
.product-detail h1 { margin-top: 0; color: var(--green-900); }
.detail-price { font-size: 1.7rem; font-weight: 800; color: var(--green-700); margin: 10px 0; }
.detail-desc { color: #374151; white-space: pre-line; }

.qty-row { display: flex; align-items: center; gap: 12px; margin: 18px 0; }
.qty-row label { font-weight: 600; }

/* ---------- Forms ---------- */
.form-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 26px;
    box-shadow: var(--shadow);
    max-width: 560px;
    margin: 0 auto;
}
.form-card.wide { max-width: 760px; }
.form-card h1, .form-card h2 { margin-top: 0; color: var(--green-900); }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
}
.form-group .hint { font-weight: 400; color: var(--ink-soft); font-size: 0.8rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="file"], input[type="date"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
    color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.15);
}
textarea { min-height: 110px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { color: var(--danger); font-size: 0.82rem; margin-top: 4px; display: block; }

.checkbox-line { display: flex; align-items: center; gap: 8px; }
.checkbox-line input { width: auto; }

.form-footer { margin-top: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-footer .muted { color: var(--ink-soft); font-size: 0.9rem; }

.auth-switch { text-align: center; margin-top: 16px; font-size: 0.92rem; color: var(--ink-soft); }

/* ---------- Tables ---------- */
.table-wrap {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: var(--shadow);
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    min-width: 620px;
}
table.data th, table.data td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.data th {
    background: var(--green-900);
    color: var(--white);
    font-weight: 600;
    font-size: 0.83rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafcf9; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.num { text-align: right; }

.thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--green-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-collecting { background: #e0e7ff; color: #3730a3; }
.badge-delivery { background: #dbeafe; color: #1e40af; }
.badge-delivered { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-role { background: var(--gold-light); color: #7c5e0e; }

.profit { color: var(--green-700); font-weight: 700; }
.loss { color: var(--danger); font-weight: 700; }

/* ---------- Cart ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }

.summary-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 84px;
}
.summary-card h3 { margin-top: 0; color: var(--green-900); }
.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    font-size: 0.95rem;
}
.summary-line.total {
    border-top: 2px solid var(--line);
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--green-800);
}

.qty-input { width: 74px !important; text-align: center; padding: 7px 6px !important; }

/* ---------- Dashboard stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 26px;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-left: 5px solid var(--green-600);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat-card.gold { border-left-color: var(--gold); }
.stat-card.red { border-left-color: var(--danger); }
.stat-card.blue { border-left-color: #2563eb; }
.stat-card .stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    font-weight: 700;
}
.stat-card .stat-value {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--green-900);
    margin-top: 4px;
}
.stat-card .stat-sub { font-size: 0.8rem; color: var(--ink-soft); }

/* ---------- Panels / order pages ---------- */
.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}
.panel h2, .panel h3 { margin-top: 0; color: var(--green-900); }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 20px;
    font-size: 0.94rem;
}
.info-grid .label { color: var(--ink-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.info-grid .value { font-weight: 600; }

.comparison-box {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 2px dashed var(--green-600);
    border-radius: 12px;
    padding: 18px;
    margin-top: 14px;
}
.comparison-box h3 { margin-top: 0; }
.compare-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.97rem;
}
.compare-row.grand {
    border-top: 2px solid var(--green-600);
    margin-top: 8px;
    padding-top: 10px;
    font-weight: 800;
    font-size: 1.12rem;
}

.locked-note {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--ink-soft);
    font-size: 0.9rem;
    display: flex;
    gap: 8px;
    align-items: center;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    padding: 6px 0 6px 22px;
    position: relative;
    font-size: 0.92rem;
}
.timeline li::before { content: "●"; position: absolute; left: 0; color: var(--green-600); }
.timeline li .when { color: var(--ink-soft); font-size: 0.82rem; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filter-bar a {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--white);
    border: 1.5px solid var(--line);
    font-size: 0.87rem;
    color: var(--ink);
}
.filter-bar a:hover { border-color: var(--green-600); text-decoration: none; }
.filter-bar a.active { background: var(--green-700); border-color: var(--green-700); color: var(--white); }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--green-900);
    color: #cfe5da;
    margin-top: auto;
    font-size: 0.88rem;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 18px;
    padding-bottom: 18px;
}
.footer-copy { opacity: 0.75; }

/* ---------- Empty states ---------- */
.empty-state {
    background: var(--white);
    border: 2px dashed var(--line);
    border-radius: 12px;
    padding: 44px 20px;
    text-align: center;
    color: var(--ink-soft);
}
.empty-state .emoji { font-size: 2.6rem; display: block; margin-bottom: 10px; }
.empty-state h3 { color: var(--ink); margin: 0 0 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .product-detail { grid-template-columns: 1fr; }
    .cart-layout { grid-template-columns: 1fr; }
    .summary-card { position: static; }
    .form-row { grid-template-columns: 1fr; }
    .hero { padding: 30px 22px; }
    .hero h1 { font-size: 1.5rem; }
    .hero .hero-emoji { display: none; }
    .header-inner { gap: 10px; }
    .main-nav { gap: 10px; }
}
