/* ---- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
:root {
    --teal: #0e7c6b;
    --teal-dark: #0a5f52;
    --black: #000;
    --orange: #f28c28;
    --green: #22b14c;
    --green-dark: #128a37;
    --blue: #1a0dab;
    --gray: #6d6d6d;
    --gray-light: #c8c8c8;
    --card: #fff;
    --text: #222;
}
html, body { margin: 0; padding: 0; }
body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--teal);
    color: var(--text);
    min-height: 100vh;
}
a { color: var(--blue); }

/* ---- Top navigation ------------------------------------------------------- */
.topnav {
    background: var(--black);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 8px;
    height: 46px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topnav .brand {
    color: #fff;
    text-decoration: none;
    font-weight: 900;
    font-size: 17px;
    letter-spacing: .5px;
    margin-right: 14px;
}
.topnav .menu {
    list-style: none;
    display: flex;
    gap: 14px;
    margin: 0;
    padding: 0;
    flex: 1;
    flex-wrap: wrap;
}
.topnav .menu a {
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 12px;
    padding: 4px 0;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.topnav .menu a:hover, .topnav .menu a.active { border-bottom-color: var(--orange); }
.logout-form { margin: 0; }
.logout {
    background: none;
    border: 0;
    color: #fff;
    font-weight: 900;
    font-size: 15px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 6px 10px;
}
.logout:hover { color: var(--orange); }

/* ---- Page & common widgets ------------------------------------------------ */
.page { padding: 14px 12px 40px; max-width: 1000px; margin: 0 auto; }
.page-title {
    text-align: center;
    text-transform: uppercase;
    font-weight: 900;
    font-size: 18px;
    color: #111;
    margin: 6px 0 16px;
}
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-success { background: #d6f5dd; color: #145a2a; }
.flash-error { background: #ffd9d9; color: #8a1c1c; }

.card { background: var(--card); border-radius: 10px; padding: 18px 22px; margin-bottom: 14px; }
.btn {
    display: inline-block;
    border: 0;
    cursor: pointer;
    font-weight: 700;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    text-decoration: none;
    font-family: inherit;
}
.btn-green { background: linear-gradient(#3ccf5a, var(--green)); color: #fff; text-transform: uppercase; border-radius: 30px; padding: 10px 40px; font-size: 13px; box-shadow: 0 2px 4px rgba(0,0,0,.25); }
.btn-green:hover { background: linear-gradient(#34b84f, var(--green-dark)); }
.btn-dark { background: #4d4d4d; color: #fff; text-transform: uppercase; font-size: 12px; padding: 5px 10px; border-radius: 3px; }
.btn-dark:hover { background: #333; }
.btn-teal { background: var(--teal-dark); color: #fff; }
.btn-teal:hover { background: #064a40; }
.badge {
    display: inline-block;
    background: var(--orange);
    color: #222;
    padding: 3px 14px;
    border-radius: 3px;
    font-size: 14px;
    margin-top: 4px;
}
.badge-status { padding: 2px 8px; font-size: 12px; border-radius: 10px; background: #e6e6e6; color: #333; text-transform: capitalize; }
.badge-status.fulfilled { background: #d6f5dd; color: #145a2a; }
.badge-status.shipped { background: #dbeafe; color: #1e3a8a; }
.badge-status.processing { background: #fef3c7; color: #92400e; }
.badge-status.pending { background: #f3f4f6; color: #374151; }
.badge-status.cancelled { background: #fee2e2; color: #991b1b; }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 8px 10px; border-bottom: 1px solid #e5e5e5; text-align: left; vertical-align: top; }
table.grid th { background: #f3f3f3; font-size: 12px; text-transform: uppercase; }
table.grid tr:hover td { background: #fafafa; }
.form-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-inline input[type=text], .form-inline input[type=number], .form-inline select, textarea.text {
    padding: 8px 10px; border: 1px solid var(--gray-light); border-radius: 6px; font-size: 14px; font-family: inherit;
}
textarea.text { width: 100%; min-height: 80px; resize: vertical; }
.muted { color: var(--gray); font-size: 13px; }
.empty { text-align: center; color: #fff; padding: 30px; font-size: 16px; }

/* ---- Search Order --------------------------------------------------------- */
.search-shell {
    background: #fff;
    border-radius: 40px;
    padding: 12px 14px 12px;
    margin: 0 auto 18px;
    box-shadow: 0 3px 6px rgba(0,0,0,.25);
}
.search-shell fieldset {
    border: 2px solid #333;
    border-radius: 30px;
    margin: 0;
    padding: 8px 14px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.search-shell legend { padding: 0 4px; font-size: 14px; color: #222; }
.search-shell .by { font-size: 14px; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.search-shell .by label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; margin-right: 4px; }
.search-shell .by input[type=radio] { accent-color: #1a73e8; width: 15px; height: 15px; margin: 0; }
.search-shell .term {
    flex: 1;
    min-width: 200px;
    background: var(--gray-light);
    border: 0;
    border-radius: 20px;
    padding: 9px 16px;
    font-size: 14px;
    color: #222;
}
.search-shell .term::placeholder { color: #fff; }
.search-shell .term:focus { outline: 2px solid var(--green); }
.search-hint { text-align: center; color: #fff; font-size: 13px; margin: -8px 0 12px; min-height: 16px; }

/* ---- Order card ----------------------------------------------------------- */
.order-card { background: #fff; border-radius: 10px; padding: 18px 16px 8px; margin-bottom: 14px; }
.order-head {
    display: grid;
    grid-template-columns: 1.4fr 1.2fr 1.8fr 1fr .8fr 1.2fr;
    gap: 10px;
    align-items: start;
    font-size: 14px;
}
.order-head .label { font-weight: 700; font-size: 14px; }
.order-head .center { text-align: center; }
.order-head .order-no { font-weight: 700; color: var(--blue); text-decoration: underline; font-size: 14px; }
.order-head .buyer div b { font-weight: 700; }
.order-head .track { text-align: center; }
.order-head .invoice { text-align: center; }
.order-head .invoice a { font-weight: 700; }

.order-items { margin-top: 26px; }
.order-item {
    display: grid;
    grid-template-columns: 90px 1fr 1fr;
    gap: 10px;
    padding: 12px 10px 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
    max-width: 480px;
    font-size: 14px;
}
.order-item img { width: 70px; height: 90px; object-fit: contain; display: block; margin: 12px auto 0; }
.order-item .name { font-weight: 700; color: var(--blue); display: inline-block; margin-bottom: 6px; }
.order-item .col div { margin-bottom: 4px; }
.order-item b { font-weight: 700; }

@media (max-width: 760px) {
    .order-head { grid-template-columns: 1fr 1fr; }
    .order-item { grid-template-columns: 80px 1fr; }
}

/* ---- Modal ---------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 20; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 10px; padding: 20px 24px; width: min(460px, 92vw); }
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.steps { display: flex; justify-content: space-between; margin: 14px 0 18px; position: relative; }
.steps::before { content: ""; position: absolute; left: 8%; right: 8%; top: 11px; height: 3px; background: #ddd; }
.step { position: relative; text-align: center; flex: 1; font-size: 12px; text-transform: capitalize; }
.step .dot { width: 24px; height: 24px; border-radius: 50%; background: #ddd; margin: 0 auto 5px; line-height: 24px; color: #fff; font-weight: 700; }
.step.done .dot { background: var(--green); }
.step.current .dot { background: var(--orange); }
.modal .close { float: right; background: none; border: 0; font-size: 20px; cursor: pointer; }
.modal ul { padding-left: 18px; font-size: 13px; }

/* ---- Login ---------------------------------------------------------------- */
.login-wrap { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 80px); }
.login-box { background: #fff; border-radius: 12px; padding: 30px 34px; width: 360px; box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.login-box h1 { text-align: center; margin: 0 0 18px; font-size: 26px; letter-spacing: 1px; }
.login-box label { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 4px; }
.login-box input[type=email], .login-box input[type=password] { width: 100%; padding: 10px; border: 1px solid var(--gray-light); border-radius: 6px; font-size: 14px; }
.login-box .btn { width: 100%; margin-top: 18px; padding: 11px; }
.login-box .error { color: #b00020; font-size: 13px; margin-top: 8px; }
.login-box .hint { text-align: center; margin-top: 14px; }

/* ---- Invoice -------------------------------------------------------------- */
.invoice { background: #fff; color: #111; max-width: 800px; margin: 0 auto; padding: 30px 36px; border-radius: 8px; }
.invoice header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #000; padding-bottom: 10px; margin-bottom: 18px; }
.invoice h1 { margin: 0; font-size: 28px; }
.invoice .meta { font-size: 13px; line-height: 1.6; }
.invoice table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 14px; }
.invoice th, .invoice td { border: 1px solid #ccc; padding: 8px; }
.invoice th { background: #f0f0f0; }
.invoice td.num, .invoice th.num { text-align: right; }
.invoice tfoot td { font-weight: 700; }
.invoice .actions { margin-top: 18px; display: flex; gap: 10px; }
@media print {
    body { background: #fff; }
    .topnav, .invoice .actions, .flash { display: none !important; }
    .page { padding: 0; }
    .invoice { border-radius: 0; box-shadow: none; }
}

/* ---- Bar chart ------------------------------------------------------------ */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chart-grid .card.wide { grid-column: 1 / -1; }
@media (max-width: 760px) { .chart-grid { grid-template-columns: 1fr; } }


/* ---- Mobile menu (hamburger) --------------------------------------------- */
.menu-toggle {
    display: none;                 /* only shown on small screens */
    background: none;
    border: 0;
    width: 40px;
    height: 40px;
    padding: 8px;
    margin-left: auto;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
}
.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
}
/* hamburger → X when open */
.topnav.open .menu-toggle span:nth-child(1) { transform: translateY(10.5px) rotate(45deg); }
.topnav.open .menu-toggle span:nth-child(2) { opacity: 0; }
.topnav.open .menu-toggle span:nth-child(3) { transform: translateY(-10.5px) rotate(-45deg); }

@media (max-width: 900px) {
    .topnav { flex-wrap: wrap; height: auto; min-height: 46px; padding: 0 12px; }
    .topnav .brand { margin-right: auto; line-height: 46px; }
    .menu-toggle { display: flex; margin-left: 0; order: 2; }
    .logout-form { order: 3; margin-left: 8px; }
    .logout { font-size: 13px; padding: 6px 4px; }

    /* Collapsible full-width menu */
    .topnav .menu {
        order: 4;
        flex: 0 0 100%;
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s ease;
        border-top: 1px solid transparent;
    }
    .topnav.open .menu { max-height: 500px; border-top-color: #333; }
    .topnav .menu li { border-bottom: 1px solid #222; }
    .topnav .menu li:last-child { border-bottom: 0; }
    .topnav .menu a {
        display: block;
        padding: 12px 6px;
        font-size: 14px;
        border-bottom: 0;
        border-left: 3px solid transparent;
    }
    .topnav .menu a:hover, .topnav .menu a.active { border-left-color: var(--orange); background: #151515; }
}

@media (max-width: 600px) {
    .page { padding: 12px 8px 30px; }
    .page-title { font-size: 16px; }

    /* Search bar stacks vertically on phones */
    .search-shell { border-radius: 20px; padding: 10px; }
    .search-shell fieldset { border-radius: 16px; flex-direction: column; align-items: stretch; padding: 8px 12px 12px; }
    .search-shell .by { justify-content: flex-start; }
    .search-shell .term { min-width: 0; width: 100%; }
    .search-shell .btn-green { width: 100%; padding: 11px; }

    /* Order card: single column, centred text */
    .order-card { padding: 14px 12px 6px; }
    .order-head { grid-template-columns: 1fr; gap: 12px; text-align: center; }
    .order-head .buyer { text-align: left; }
    .order-item { grid-template-columns: 70px 1fr; max-width: none; }
    .order-item .col:last-child { grid-column: 2; }
    .order-item img { width: 56px; height: 72px; margin-top: 4px; }

    table.grid { display: block; overflow-x: auto; white-space: nowrap; }
}
