/* ==========================================================================
   AvirShop theme — matches the avirtech.co identity:
   light surfaces, blue gradient accents, dark-slate text, geometric sans.
   All brand values are CSS variables in :root so the theme is easy to retune.
   ========================================================================== */

:root {
    /* Brand blue (avirtech.co gradient) */
    --brand-400: #5aa6f7;
    --brand-500: #2e86f0;
    --brand-600: #1366d6; /* primary */
    --brand-700: #0e4fa8;
    --brand-gradient: linear-gradient(135deg, #1366d6 0%, #36a0f0 100%);

    /* Neutrals */
    --ink: #16202e;
    --muted: #5c6b7f;
    --bg: #ffffff;
    --surface: #f5f8fc;
    --surface-2: #eef3fa;
    --border: #e2e8f0;
    --footer-bg: #0f1b2d;
    --footer-ink: #c7d2e0;

    /* Status */
    --success: #1b9e5a;
    --danger: #d64545;
    --warn: #e0a106;

    /* Shape & type */
    --radius: 10px;
    --radius-sm: 7px;
    --shadow-sm: 0 1px 2px rgba(16, 32, 46, .06), 0 1px 3px rgba(16, 32, 46, .08);
    --shadow: 0 6px 24px rgba(16, 32, 46, .10);
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --container: 1140px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 32px 20px 64px;
    flex: 1 0 auto;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; font-weight: 700; }
h1 { font-size: 1.9rem; margin: 0 0 .6em; }
h2 { font-size: 1.3rem; margin: 1.4em 0 .6em; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); text-decoration: underline; }

/* ---- Header / nav ------------------------------------------------------- */
body > header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.site-header {
    max-width: var(--container);
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -.02em;
    color: var(--ink);
    text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .brand-accent {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.site-header form[role="search"] { margin-left: auto; display: flex; gap: 6px; }
.site-header input[type="search"] {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    min-width: 220px;
    font: inherit;
}
.site-nav { display: flex; align-items: center; gap: 18px; }
.site-nav a { color: var(--muted); font-weight: 500; font-size: .95rem; }
.site-nav a:hover { color: var(--brand-600); text-decoration: none; }
.site-nav form { display: inline; }
.site-nav button { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; padding: 0; }
.site-nav button:hover { color: var(--brand-600); }

/* ---- Buttons ------------------------------------------------------------ */
button, .button, input[type="submit"] {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    color: #fff;
    background: var(--brand-gradient);
    box-shadow: var(--shadow-sm);
    transition: transform .04s ease, filter .15s ease;
    text-decoration: none;
}
button:hover, .button:hover, input[type="submit"]:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
button:active, .button:active { transform: translateY(1px); }
button[disabled], button:disabled {
    background: var(--surface-2);
    color: var(--muted);
    cursor: not-allowed;
    box-shadow: none;
}

/* ---- Hero --------------------------------------------------------------- */
.hero {
    background: var(--brand-gradient);
    color: #fff;
    border-radius: var(--radius);
    padding: 40px 36px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
}
.hero h1 { color: #fff; margin: 0 0 .3em; font-size: 2.1rem; }
.hero p { margin: 0; color: rgba(255, 255, 255, .9); font-size: 1.05rem; }

/* ---- Catalog ------------------------------------------------------------ */
.catalog { display: grid; grid-template-columns: 230px 1fr; gap: 32px; align-items: start; }
.catalog-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.catalog-nav h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 0 6px; }
.catalog-nav h2:first-child { margin-top: 0; }
.catalog-nav ul { list-style: none; margin: 0 0 8px; padding: 0; }
.catalog-nav li { margin: 3px 0; }

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.product-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: box-shadow .15s ease, transform .08s ease;
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card .card-thumb { display: block; }
.product-card .card-thumb img { width: 100%; height: 150px; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface); }
.product-card > a:first-child { font-weight: 600; color: var(--ink); }
.product-card .brand { color: var(--muted); font-size: .85rem; }
.product-card .price { font-weight: 700; font-size: 1.15rem; color: var(--brand-700); }
.product-card .stock { color: var(--danger); font-size: .85rem; font-weight: 600; }
.product-card form { margin-top: auto; }

/* ---- Product detail ----------------------------------------------------- */
.product-detail .price { font-size: 1.6rem; font-weight: 700; color: var(--brand-700); }
.product-detail .availability { color: var(--success); font-weight: 600; }
.specs, table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.specs th, .specs td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }

/* ---- Tables (cart, orders, admin) -------------------------------------- */
table { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
thead { background: var(--surface); }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }

.cart-summary, .order-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-top: 20px; max-width: 360px; }
.cart-summary p, .order-summary p { margin: 6px 0; }

/* ---- Forms -------------------------------------------------------------- */
form label { display: block; margin: 12px 0; font-weight: 500; color: var(--ink); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], select, textarea {
    font: inherit;
    width: 100%;
    max-width: 420px;
    padding: 9px 12px;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(46, 134, 240, .18); }
label input[type="checkbox"], label input[type="radio"] { width: auto; margin-right: 6px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0; }
legend { font-weight: 600; padding: 0 6px; }

.errors { background: #fdecec; border: 1px solid #f4c2c2; color: var(--danger); border-radius: var(--radius-sm); padding: 10px 14px 10px 28px; }
.status { background: #e8f6ee; border: 1px solid #b9e3cb; color: var(--success); border-radius: var(--radius-sm); padding: 10px 14px; }

/* ---- Notifications ------------------------------------------------------ */
.notification { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.notification.unread { background: var(--surface-2); font-weight: 600; }

/* ---- Pagination (Laravel default markup) -------------------------------- */
nav[role="navigation"] svg { width: 18px; height: 18px; }
.pagination, nav[role="navigation"] { margin-top: 24px; }

/* ---- Footer ------------------------------------------------------------- */
body > footer {
    flex-shrink: 0;
    background: var(--footer-bg);
    color: var(--footer-ink);
    margin-top: 48px;
}
.site-footer {
    max-width: var(--container);
    margin: 0 auto;
    padding: 36px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 28px 48px;
    align-items: flex-start;
}
.site-footer .footer-brand { font-weight: 700; font-size: 1.1rem; color: #fff; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-footer a { color: var(--footer-ink); font-size: .92rem; }
.site-footer a:hover { color: #fff; }
.site-footer .footer-copy { width: 100%; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 16px; color: #8696ab; font-size: .85rem; }

/* ==========================================================================
   Form & UI alignment refinements
   ========================================================================== */

/* Centered card for single-column form pages (auth, checkout). */
.form-page {
    max-width: 520px;
    margin: 0 auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 28px;
}
.form-page > h1:first-child { margin-top: 0; }
.form-page > a { display: inline-block; margin-top: 16px; }

/* Forms: readable width, consistent vertical rhythm, full-width controls. */
main form { max-width: 560px; }
.form-page form { max-width: none; }

main form label {
    display: block;
    margin: 0 0 16px;
    font-weight: 500;
}
main form input:not([type="checkbox"]):not([type="radio"]),
main form select,
main form textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-top: 6px;
}
main form textarea { min-height: 140px; resize: vertical; }

/* Checkbox / radio rows: control and label text on one aligned line. */
main form label:has(> input[type="checkbox"]),
main form label:has(> input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

/* Action buttons sit on their own aligned row. */
main form button,
main form input[type="submit"],
main form .button { margin-top: 6px; }

/* Inline action forms inside table cells (edit/delete, qty update/remove). */
table td { vertical-align: middle; }
table td form { display: inline-block; max-width: none; margin: 0 0 0 8px; }
table td > a + form { margin-left: 8px; }
table td form:first-child { margin-left: 0; }
table td form input[type="number"] {
    display: inline-block;
    width: 5rem;
    margin: 0 6px 0 0;
}

/* Catalog/cart add-to-cart forms shouldn't stretch full width. */
.product-card form,
.catalog form { max-width: none; }
.product-card form button { width: 100%; }

/* Header + footer: vertically aligned. */
.site-header { align-items: center; }
.site-footer { align-items: baseline; }

/* Right-align money/total summaries. */
.cart-summary, .order-summary { margin-left: auto; }

/* ---- Product image gallery + zoom --------------------------------------- */
.gallery { margin: 8px 0 20px; }
.gallery-main img {
    max-width: 100%;
    max-height: 440px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: zoom-in;
    object-fit: contain;
    background: var(--surface);
}
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gallery-thumbs .thumb {
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    overflow: hidden;
    width: 64px;
    height: 64px;
}
.gallery-thumbs .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumbs .thumb.is-active { border-color: var(--brand-600); }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 16, 28, .9);
    cursor: zoom-out;
    padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 95vw; max-height: 92vh; border-radius: var(--radius); }
.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    box-shadow: none;
    font-size: 2rem;
    line-height: 1;
    padding: 4px 10px;
}
body.lightbox-open { overflow: hidden; }

/* Admin image management thumbnails */
.admin-images { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.admin-images figure { margin: 0; text-align: center; }
.admin-images img { width: 90px; height: 90px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-sm); display: block; }
.admin-images button { margin-top: 4px; padding: 4px 10px; font-size: .8rem; }
.admin-images figure { cursor: grab; }
.admin-images figure.dragging { opacity: .4; }
.hidden { display: none; }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0; }

/* ---- Admin area --------------------------------------------------------- */
.admin-layout { display: grid; grid-template-columns: 210px 1fr; gap: 28px; align-items: start; }
.admin-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: sticky;
    top: 84px;
}
.admin-menu h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.admin-menu nav { display: flex; flex-direction: column; gap: 2px; }
.admin-menu nav a { padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; }
.admin-menu nav a:hover { background: var(--surface-2); color: var(--brand-600); text-decoration: none; }
.admin-menu nav a.active { background: var(--brand-gradient); color: #fff; }
.admin-content { min-width: 0; }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.stat-card .num { font-size: 1.9rem; font-weight: 700; color: var(--brand-700); line-height: 1.1; }
.stat-card .label { color: var(--muted); font-size: .85rem; margin-top: 4px; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 760px) {
    .catalog { grid-template-columns: 1fr; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-menu { position: static; }
    .admin-menu nav { flex-direction: row; flex-wrap: wrap; }
    .site-header { flex-wrap: wrap; }
    .site-header form[role="search"] { order: 3; width: 100%; }
    .site-header input[type="search"] { width: 100%; min-width: 0; }
    .form-page { padding: 20px; }
}
