/* ================================================================
   Projects Publisher — Wizard Styles
   Mirrors Media Manager design language (Corvex brand)
================================================================ */

:root {
  --navy: #0C2442; --navy-mid: #163459; --navy-light: #1e4a7a;
  --crimson: #9E1B34; --crimson-lt: #b82340; --red: #EB212E;
  --gray-100: #f7f8fa; --gray-200: #eceef2; --gray-300: #d1d5db;
  --gray-500: #6b7280; --gray-700: #374151; --white: #ffffff;
  --status-red: #dc2626; --status-yellow: #d97706; --status-green: #16a34a; --status-blue: #2563eb;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(12,36,66,.10); --shadow-lg: 0 8px 32px rgba(12,36,66,.18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: 'Barlow', sans-serif; background: var(--gray-100); color: var(--gray-700); min-height: 100dvh; overflow-x: hidden; }
input, button, textarea, select { font-family: inherit; font-size: inherit; }
img, video { display: block; max-width: 100%; }

/* ── LOGIN ──────────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0; z-index: 100; background: var(--navy);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem;
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(158,27,52,.25) 0%, transparent 70%), linear-gradient(180deg, #0a1e38 0%, #0C2442 100%);
}

/* ── LAYOUT ─────────────────────────────────────────────── */
#app { display: none; flex-direction: column; min-height: 100dvh; }
#app.visible { display: flex; }
.app-header { position: sticky; top: 0; z-index: 50; background: var(--navy); padding: .85rem 1.25rem; display: flex; align-items: center; gap: .75rem; box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.app-header .tag { font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.2); border-radius: 5px; padding: .25rem .6rem; }
.header-logo-img { height: 38px; width: auto; display: block; mix-blend-mode: screen; }
.logout-btn { margin-left: auto; background: none; border: none; color: rgba(255,255,255,.45); cursor: pointer; padding: .4rem; border-radius: 50%; transition: all .15s; display: flex; align-items: center; justify-content: center; }
.logout-btn:hover { color: #fff; background: rgba(255,255,255,.1); }

@media (min-width: 768px) {
  .main-layout { display: flex; flex: 1; overflow: hidden; }
  .sidebar { width: 340px; flex-shrink: 0; border-right: 1px solid var(--gray-200); background: var(--white); display: flex; flex-direction: column; overflow: hidden; }
  .sidebar .toolbar { border-bottom: 1px solid var(--gray-200); }
  .sidebar .project-list { overflow-y: auto; flex: 1; }
  .wizard-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
  .wizard-scroll { overflow-y: auto; flex: 1; }
}
@media (max-width: 767px) {
  .sidebar { border-bottom: 1px solid var(--gray-200); }
  .project-list { max-height: 200px; overflow-y: auto; }
}

/* ── SIDEBAR ────────────────────────────────────────────── */
.toolbar { background: var(--white); border-bottom: 1px solid var(--gray-200); padding: .75rem 1rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar-search { flex: 1 1 200px; min-width: 0; padding: .55rem .85rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm); outline: none; font-size: .9rem; }
.toolbar-search:focus { border-color: var(--navy-light); }

.project-list { padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }

/* ── PROJECT CARDS ──────────────────────────────────────── */
.project-card { background: var(--white); border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); padding: .85rem 1rem; cursor: pointer; transition: border-color .2s, box-shadow .2s; display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.project-card:hover { border-color: var(--navy-light); box-shadow: var(--shadow); }
.project-card.active { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(12,36,66,.15); }
.project-card-info { min-width: 0; flex: 1; }
.project-card-name { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1rem; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-card-location { font-size: .8rem; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; flex-shrink: 0; }

.status-badge { font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; padding: .2rem .5rem; border-radius: 4px; white-space: nowrap; }
.status-requires_media { background: rgba(220,38,38,.1); color: var(--status-red); }
.status-requires_customization { background: rgba(217,119,6,.1); color: var(--status-yellow); }
.status-ready_for_review { background: rgba(22,163,106,.1); color: var(--status-green); }
.status-pushed { background: rgba(37,99,235,.1); color: var(--status-blue); }

.spotlight-star { width: 18px; height: 18px; cursor: pointer; opacity: .25; transition: opacity .15s; }
.spotlight-star.active { opacity: 1; }
.spotlight-star svg { width: 18px; height: 18px; fill: #fbbf24; stroke: #d97706; stroke-width: 1; }

.pushed-link { font-size: .7rem; color: var(--status-blue); text-decoration: none; }
.pushed-link:hover { text-decoration: underline; }

/* ── WIZARD ─────────────────────────────────────────────── */
.wizard-scroll { padding: 1.25rem; }
.wizard-empty { text-align: center; padding: 4rem 1rem; color: var(--gray-500); }
.wizard-empty h3 { font-family: 'Barlow Condensed', sans-serif; font-size: 1.15rem; color: var(--gray-700); margin-bottom: .35rem; }

.wizard-section { background: var(--white); border: 1.5px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.wizard-section-title { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); margin-bottom: .85rem; display: flex; align-items: center; gap: .5rem; }

/* ── IMAGE SLOTS ────────────────────────────────────────── */
.image-slot { width: 100%; aspect-ratio: 16/10; background: var(--gray-100); border: 2px dashed var(--gray-300); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; cursor: pointer; transition: border-color .2s; }
.image-slot:hover { border-color: var(--navy-light); }
.image-slot img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.image-slot .slot-label { font-size: .8rem; color: var(--gray-500); text-align: center; }
.image-slot .swap-btn { position: absolute; bottom: .5rem; right: .5rem; padding: .3rem .6rem; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 4px; font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; backdrop-filter: blur(4px); }
.image-slot .swap-btn:hover { background: rgba(0,0,0,.8); }

.ba-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.ba-grid .ba-label { font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); margin-bottom: .35rem; }

/* ── GALLERY GRID ───────────────────────────────────────── */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; }
.gallery-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.gallery-item.selected { border-color: var(--crimson); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-item .gallery-check { position: absolute; top: .25rem; right: .25rem; width: 20px; height: 20px; background: rgba(0,0,0,.4); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.gallery-item.selected .gallery-check { background: var(--crimson); }
.gallery-item .gallery-check svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 3; fill: none; }
.gallery-empty { padding: 1.5rem; text-align: center; color: var(--gray-500); font-size: .85rem; background: var(--gray-100); border-radius: var(--radius-sm); }

.section-picker { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--gray-200); }
.picker-label { font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); margin-bottom: .5rem; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── CONTENT FIELDS ─────────────────────────────────────── */
.field-group { margin-bottom: 1rem; }
.field-group:last-child { margin-bottom: 0; }
.field-label { display: block; font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; color: var(--navy); margin-bottom: .35rem; }
.field-input { width: 100%; padding: .65rem .85rem; border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm); font-size: .9rem; color: var(--gray-700); background: var(--gray-100); outline: none; transition: border-color .2s, background .2s; }
.field-input:focus { border-color: var(--navy-light); background: var(--white); }
textarea.field-input { resize: vertical; min-height: 80px; line-height: 1.5; }
textarea.field-input.description { min-height: 200px; }
.generate-btn { margin-top: .75rem; padding: .55rem 1rem; background: var(--navy); color: var(--white); border: none; border-radius: var(--radius-sm); font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; transition: background .15s; }
.generate-btn:hover { background: var(--navy-mid); }

/* ── ACTIONS BAR ────────────────────────────────────────── */
.actions-bar { background: var(--white); border-top: 1px solid var(--gray-200); padding: .85rem 1.25rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.actions-left { display: flex; align-items: center; gap: .75rem; }
.actions-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.action-btn { padding: .55rem 1rem; border-radius: var(--radius-sm); font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; cursor: pointer; transition: all .15s; border: 1.5px solid var(--gray-300); background: var(--white); color: var(--gray-700); }
.action-btn:hover { border-color: var(--navy); color: var(--navy); }
.action-btn.primary { background: var(--crimson); color: var(--white); border-color: var(--crimson); }
.action-btn.primary:hover { background: var(--crimson-lt); border-color: var(--crimson-lt); }
.action-btn:disabled { opacity: .4; cursor: default; }

.publish-toggle { display: flex; align-items: center; gap: .5rem; font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); }
.publish-toggle input[type="checkbox"] { appearance: none; width: 36px; height: 20px; background: var(--gray-300); border-radius: 10px; position: relative; cursor: pointer; transition: background .2s; }
.publish-toggle input[type="checkbox"]::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform .2s; }
.publish-toggle input[type="checkbox"]:checked { background: var(--status-green); }
.publish-toggle input[type="checkbox"]:checked::after { transform: translateX(16px); }

/* ── LOCKED STATE ───────────────────────────────────────── */
.wizard-locked .field-input { background: var(--gray-200); color: var(--gray-500); pointer-events: none; }
.wizard-locked .image-slot { pointer-events: none; opacity: .7; }
.wizard-locked .gallery-item { pointer-events: none; }
.pushed-banner { background: var(--status-blue); color: #fff; padding: .85rem 1.25rem; text-align: center; font-family: 'Barlow Condensed', sans-serif; font-weight: 600; font-size: .9rem; letter-spacing: .03em; }
.pushed-banner a { color: #fff; text-decoration: underline; }

/* ── TOAST ──────────────────────────────────────────────── */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .6rem 1.25rem; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 999; opacity: 0; transition: opacity .3s; pointer-events: none; }
.toast.visible { opacity: 1; }

/* ── MODAL ──────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal-card { background: var(--white); border-radius: var(--radius); padding: 1.5rem; max-width: 400px; width: 100%; text-align: center; }
.modal-card h3 { font-family: 'Barlow Condensed', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--navy); margin-bottom: .75rem; }
.modal-card p { font-size: .9rem; color: var(--gray-500); margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: center; }
