/* Photo Inventory Control — base styles */

:root {
    --primary: #1e3a5f;
    --primary-light: #2d5486;
    --bg: #f4f5f7;
    --bg-white: #ffffff;
    --border: #e2e5ea;
    --text: #1f2430;
    --text-muted: #6b7280;
    --ok: #16a34a;
    --warn: #b45309;
    --danger: #dc2626;
    --radius: 8px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14.5px;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Top nav ── */
.topnav { background: var(--primary); color: #fff; }
.topnav-inner {
    max-width: 1400px; margin: 0 auto; padding: .6rem 1.25rem;
    display: flex; align-items: center; gap: 1.5rem;
}
.brand { color: #fff; font-weight: 800; font-size: 1.05rem; text-decoration: none; display: flex; align-items: center; gap: .55rem; }
.brand-logo { height: 28px; width: auto; display: block; }
.nav-links { display: flex; gap: .25rem; flex: 1; }
.nav-links a {
    color: #dbe4f0; text-decoration: none; padding: .4rem .8rem;
    border-radius: var(--radius); font-weight: 600;
}
.nav-links a:hover { background: var(--primary-light); color: #fff; }
.user-box { display: flex; align-items: center; gap: .6rem; }
.user-name { font-weight: 600; }

/* ── Layout ── */
.page { flex: 1; max-width: 1400px; margin: 0 auto; padding: 1.25rem; width: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.page-header h1 { margin: 0 0 .2rem; font-size: 1.4rem; }
.footer {
    display: flex; justify-content: space-between; padding: .8rem 1.25rem;
    font-size: .78rem; color: var(--text-muted); border-top: 1px solid var(--border);
}

.card {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem;
}

/* ── Login ── */
.login-body { display: flex; align-items: center; justify-content: center; background: var(--primary); }
.login-wrap { text-align: center; }
.login-logo { height: 56px; width: auto; margin-bottom: 1.25rem; }
.login-card {
    background: #fff; border-radius: 12px; padding: 2.5rem 3rem; text-align: center;
    max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card h1 { margin: 0 0 .3rem; font-size: 1.3rem; }
.btn-google {
    display: inline-flex; align-items: center; gap: .6rem; margin: 1.2rem 0;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: .65rem 1.4rem; font-weight: 700; color: var(--text); text-decoration: none;
}
.btn-google:hover { border-color: var(--primary); }

/* ── Buttons, badges, pills ── */
.btn {
    border: none; border-radius: var(--radius); padding: .5rem 1rem;
    font-weight: 700; cursor: pointer; font-size: .875rem; text-decoration: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost { background: transparent; color: inherit; border: none; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

.badge {
    font-size: .68rem; font-weight: 800; text-transform: uppercase;
    padding: .15rem .5rem; border-radius: 999px; letter-spacing: .03em;
}
.badge-admin   { background: #fee2e2; color: #991b1b; }
.badge-manager { background: #cffafe; color: #155e75; }
.badge-user    { background: #e2e8f0; color: #334155; }
/* Status badges (Airtable Outfits + general use) */
.badge-ok      { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.badge-warn    { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-danger  { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }
.text-warn     { color: #92400e; }

/* Outfit builder: multiple pieces per slot */
.at-piece        { display: flex; gap: .35rem; align-items: center; margin: .25rem 0; }
.at-piece input  { flex: 1; }
.at-piece-result { margin: .15rem 0; }
.at-add-piece    { margin-top: .3rem; }

/* Type-ahead picker (PFID slot boxes, PO number) */
.at-picker-host  { position: relative; }
.at-picker {
    position: absolute; top: 100%; left: 0; z-index: 60;
    min-width: 320px; max-width: 460px; max-height: 330px; overflow-y: auto;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .14);
}
.at-picker-row {
    display: flex; gap: .55rem; align-items: center;
    padding: .45rem .65rem; cursor: pointer; border-bottom: 1px solid #f1f5f9;
}
.at-picker-row:last-child { border-bottom: none; }
.at-picker-row:hover { background: #f8fafc; }
.at-picker-img {
    width: 36px; height: 36px; object-fit: cover; border-radius: 4px; flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.at-picker-main { font-size: .85rem; line-height: 1.3; }
.at-picker-sub  { font-size: .75rem; color: #6b7280; }

.pill {
    font-size: .7rem; font-weight: 700; padding: .15rem .55rem;
    border-radius: 999px; white-space: nowrap;
}
.pill-ok     { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.pill-warn   { background: #fffbeb; color: var(--warn); border: 1px solid #fde68a; }
.pill-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fca5a5; }

/* ── Alerts ── */
.alert { border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: .8rem; font-size: .875rem; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warn    { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); text-align: left; }
thead th {
    background: var(--primary); color: #fff; font-size: .72rem;
    text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0;
}
tbody tr:hover td { background: #f8fafc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.bold { font-weight: 700; }
.empty { text-align: center; color: var(--text-muted); padding: 2rem !important; }
.row-danger td { background: #fef2f2; }
.actions { white-space: nowrap; }
.inline-form { display: inline-flex; gap: .3rem; align-items: center; margin-right: .4rem; }

/* ── Filter bar ── */
.filter-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.filter-bar input[type=search] {
    padding: .45rem .6rem; border: 1px solid var(--border);
    border-radius: var(--radius); min-width: 130px; flex: 1;
}
.filter-bar .btn { margin-left: auto; }

/* ── Stat cards ── */
.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat-card { text-align: center; }
.stat-value { font-size: 1.6rem; font-weight: 800; }
.stat-label { font-weight: 600; font-size: .8rem; }

/* ── Forms & modal ── */
input, select, textarea {
    font: inherit; padding: .45rem .6rem;
    border: 1px solid var(--border); border-radius: var(--radius);
}
label { display: block; font-weight: 700; font-size: .8rem; margin: .8rem 0 .25rem; }
.form-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
    display: flex; align-items: center; justify-content: center; z-index: 100;
}
/* the hidden attribute must beat display:flex above */
[hidden] { display: none !important; }
.modal {
    background: #fff; border-radius: 12px; padding: 1.5rem 1.75rem;
    width: min(480px, 92vw); max-height: 88vh; overflow: auto;
}
.modal h2 { margin: 0 0 .3rem; font-size: 1.1rem; }
.modal select, .modal input[type=date], .modal textarea { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; }
.hold-item-list {
    margin: .4rem 0; padding: .5rem .8rem; background: var(--bg);
    border-radius: var(--radius); font-size: .78rem; max-height: 130px;
    overflow: auto; list-style: none;
}

.text-muted { color: var(--text-muted); }
.text-sm { font-size: .8rem; }

/* ── Home dashboard ── */
.section-heading {
    font-size: .82rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-muted); margin: 1.4rem 0 .6rem;
}
.stat-link { text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.stat-link:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(30, 58, 95, .12); }
.stat-alert { border-color: #fca5a5; background: #fef2f2; }
.stat-alert .stat-value { color: var(--danger); }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .9rem; }
.module-card {
    display: flex; gap: .9rem; align-items: flex-start;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem 1.25rem;
    text-decoration: none; color: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.module-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(30, 58, 95, .12); }
.module-icon {
    font-size: 1.5rem; width: 46px; height: 46px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.module-card h4 { margin: 0 0 .25rem; font-size: .95rem; color: var(--primary); }
.module-card p { margin: 0 0 .35rem; font-size: .82rem; color: var(--text-muted); }

.freq-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.freq-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .4rem .9rem; border-radius: 999px;
    background: var(--bg-white); border: 1px solid var(--border);
    font-weight: 600; font-size: .85rem; text-decoration: none; color: inherit;
}
.freq-chip:hover { border-color: var(--primary); }

/* ── Request form (module 2) ── */
.req-type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .5rem; margin: .3rem 0 .5rem; }
.req-type-card {
    display: flex; align-items: center; gap: .5rem; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: .7rem .9rem; font-weight: 600;
}
.req-type-card:has(input:checked) { border-color: var(--primary); background: #eef3f9; }
.form-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }

.cat-search { position: relative; }
.cat-search-row { display: flex; gap: .5rem; }
.cat-search input { width: 100%; flex: 1; }
.search-block { margin-bottom: .6rem; }
.search-block-label { font-size: .78rem; font-weight: 700; margin-bottom: .25rem; }
.search-block-label .text-muted { font-weight: 500; }

/* mode switcher: hint on the left, corner icons on the right */
.search-mode-bar {
    display: flex; justify-content: space-between; align-items: center;
    gap: .5rem; margin-bottom: .35rem;
}
.search-mode-bar .search-block-label { margin-bottom: 0; }
.search-mode-icons { display: flex; gap: .25rem; flex-shrink: 0; }
.mode-icon {
    border: 1px solid var(--border); background: var(--bg-white);
    border-radius: var(--radius); width: 30px; height: 30px;
    font-size: .95rem; line-height: 1; cursor: pointer; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    filter: grayscale(1); opacity: .55;
    transition: border-color .12s, opacity .12s;
}
.mode-icon:hover { border-color: var(--primary); opacity: .85; }
.mode-icon.active {
    border-color: var(--primary); background: #eef3f9;
    filter: none; opacity: 1;
}
.cat-group-click { cursor: pointer; }
.cat-group-click:hover strong { color: var(--primary); }
.cat-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.14);
    max-height: 340px; overflow: auto;
}
.cat-group { padding: .55rem .8rem; border-bottom: 1px solid var(--border); }
.cat-group:last-child { border-bottom: none; }
.cat-group-head { font-size: .85rem; margin-bottom: .35rem; }
.cat-variants { display: flex; flex-wrap: wrap; gap: .3rem; }
.cat-variant {
    border: 1px solid var(--border); background: var(--bg);
    border-radius: 999px; padding: .18rem .6rem; font-size: .76rem;
    cursor: pointer; font-weight: 600;
}
.cat-variant:hover { border-color: var(--primary); background: #eef3f9; }
.cat-empty { padding: .8rem; color: var(--text-muted); font-size: .85rem; }

.req-lines { margin: .8rem 0; }
.req-lines td, .req-lines th { padding: .35rem .5rem; }

/* ── Selected products: card view (default) / table view ── */
.lines-bar { margin-top: 1rem; }
.line-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .6rem; margin: .35rem 0 .8rem;
}
.line-card {
    position: relative; background: var(--bg-white);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: .55rem .55rem .65rem; text-align: center;
}
.line-card-remove {
    position: absolute; top: .3rem; right: .3rem; z-index: 2;
    width: 22px; height: 22px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--bg-white); color: var(--text-muted);
    font-size: .7rem; line-height: 1; cursor: pointer; padding: 0;
}
.line-card-remove:hover { color: var(--danger); border-color: var(--danger); }
.line-card-img {
    height: 130px; display: flex; align-items: center; justify-content: center;
    background: var(--bg); border-radius: var(--radius); overflow: hidden;
}
.line-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.line-card-ph { font-size: 1.8rem; opacity: .35; }
.line-card-name {
    font-size: .8rem; font-weight: 600; line-height: 1.25;
    margin: .45rem 0 .15rem; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.line-card-meta { font-size: .74rem; color: var(--text-muted); }
.line-card-qty {
    display: flex; align-items: center; justify-content: center; gap: .35rem;
    margin-top: .45rem; font-size: .74rem; font-weight: 600; color: var(--text-muted);
}
.line-card-qty input { width: 58px; padding: .25rem .4rem; text-align: center; }

/* ── Self-service nav (standalone request pages) ── */
.self-nav { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.self-nav a { color: #dbe4f0; text-decoration: none; font-weight: 600; font-size: .85rem; }
.self-nav a:hover { color: #fff; }
.self-nav-form { display: inline; }
.self-nav-form button {
    background: none; border: none; padding: 0; cursor: pointer;
    color: #dbe4f0; font-weight: 600; font-size: .85rem; font-family: inherit;
}
.self-nav-form button:hover { color: #fff; }

/* ── Product photos on request lines ── */
.line-thumb-cell { width: 52px; }
.line-thumb {
    width: 44px; height: 44px; object-fit: contain; display: block;
    background: var(--bg); border-radius: 6px;
}
.line-thumb-ph { font-size: 1.2rem; opacity: .35; }

/* My requests: line rows with photo */
.my-line {
    display: flex; align-items: center; gap: .8rem;
    padding: .5rem 0; border-bottom: 1px solid var(--border);
}
.my-line:last-of-type { border-bottom: none; }
.my-line-img {
    width: 64px; height: 64px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg); border-radius: var(--radius); overflow: hidden;
}
.my-line-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.my-line-name { font-weight: 600; font-size: .88rem; }

/* ── Inventory photo cards ── */
.inv-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: .6rem; margin-top: .4rem;
}
.inv-card {
    position: relative; background: var(--bg-white);
    border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden;
}
.inv-card-selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(30, 58, 95, .25); }
.inv-card-check {
    position: absolute; top: .4rem; left: .4rem; z-index: 2;
    background: rgba(255, 255, 255, .92); border: 1px solid var(--border);
    border-radius: 6px; padding: .2rem .3rem; line-height: 1;
    display: flex; cursor: pointer;
}
.inv-card-check input { margin: 0; width: 16px; height: 16px; cursor: pointer; }
.inv-card-img {
    position: relative; height: 170px; cursor: zoom-in;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
.inv-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.inv-card-noimg { cursor: default; }
.inv-days {
    position: absolute; bottom: .4rem; right: .4rem;
    font-size: .7rem; font-weight: 800; padding: .12rem .45rem;
    border-radius: 999px; border: 1px solid;
}
.inv-days-ok     { background: #f0fdf4; color: var(--ok); border-color: #bbf7d0; }
.inv-days-warn   { background: #fffbeb; color: var(--warn); border-color: #fde68a; }
.inv-days-danger { background: #fef2f2; color: var(--danger); border-color: #fca5a5; }
.inv-days-held   { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }

/* Held items shown on the inventory page (exempt from the 10-day rule) */
.pill-held { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }

/* Home: inline seasonal-limit editor on the studio-images card */
.limit-form { display: flex; gap: .3rem; justify-content: center; margin-top: .5rem; }
.limit-form input[type=number] { width: 84px; padding: .25rem .4rem; text-align: center; }
.inv-card-body { padding: .5rem .6rem .6rem; }
.inv-card-name {
    font-size: .8rem; font-weight: 600; line-height: 1.25; overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.inv-card-meta { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; }

/* Full-size image lightbox */
.img-lightbox {
    position: fixed; inset: 0; z-index: 200; cursor: zoom-out;
    background: rgba(15, 23, 42, .82);
    display: flex; align-items: center; justify-content: center;
}
.img-lightbox figure { margin: 0; text-align: center; max-width: 92vw; }
.img-lightbox img {
    max-width: 92vw; max-height: 84vh; object-fit: contain;
    background: #fff; border-radius: 10px;
}
.img-lightbox figcaption { color: #e2e8f0; font-size: .85rem; margin-top: .6rem; }

/* Export links (view bars) */
.export-links { margin-left: auto; margin-right: .8rem; font-size: .78rem; color: var(--text-muted); white-space: nowrap; }
.export-links a { color: var(--primary); text-decoration: none; font-weight: 700; }
.export-links a:hover { text-decoration: underline; }
.search-mode-bar .search-mode-icons { margin-left: 0; }

/* Holding cards: wider, with actions in the card */
.hold-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.hold-card-note {
    overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-style: italic;
}
.hold-card-actions {
    display: flex; flex-wrap: wrap; gap: .3rem; align-items: center;
    margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border);
}
.hold-card-extend { display: flex; gap: .3rem; align-items: center; }
.hold-card-extend input[type=date] { padding: .25rem .35rem; font-size: .75rem; width: 128px; }


/* Catalog search results: style thumbnails */
.cat-group-head { display: flex; align-items: center; gap: .55rem; }
.cat-thumb {
    width: 40px; height: 40px; object-fit: contain; flex-shrink: 0;
    background: var(--bg); border-radius: 6px;
}
