/* =========================================
   ScentCast — styles.css
   Dark elegant theme with gold accents
   ========================================= */

:root {
  --bg:        #0c0c10;
  --surface:   #13131a;
  --surface-2: #1c1c26;
  --border:    #2a2a38;
  --gold:      #c9a84c;
  --gold-dim:  #9b7830;
  --gold-glow: rgba(201, 168, 76, 0.12);
  --text:      #e8e6df;
  --text-muted: #8a8898;
  --text-dim:  #555567;
  --error:     #e05a5a;
  --success:   #5ab88e;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,0.5);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

/* ---- Layout ---- */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---- Header ---- */
.site-header {
  background: linear-gradient(180deg, #0f0f16 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.25rem 1.5rem;
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.logo span {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #e8c97e 0%, #c9a84c 50%, #9b6e2e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.card-header h2 svg { color: var(--gold); flex-shrink: 0; }

/* ---- Badge ---- */
.badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.badge.configured {
  background: rgba(90, 184, 142, 0.1);
  border-color: rgba(90, 184, 142, 0.3);
  color: var(--success);
}

/* ---- Setup Section ---- */
.setup-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .fields-row { grid-template-columns: 1fr; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-wrap {
  position: relative;
}

.input-wrap input {
  width: 100%;
  padding-right: 2.5rem;
}

.toggle-visibility {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.toggle-visibility:hover { color: var(--gold); }

.privacy-note {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.privacy-note code {
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--text-muted);
}

/* ---- Inputs ---- */
input[type="text"],
input[type="password"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-dim);
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #c9a84c, #9b6e2e);
  color: #0c0c10;
  border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 0 3px var(--gold-glow), 0 2px 12px rgba(201,168,76,0.25);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: var(--gold-glow);
}

/* ---- Location Section ---- */
.location-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.city-search {
  display: flex;
  gap: 0.6rem;
}

.city-input {
  flex: 1;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.or-divider::before,
.or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Loading ---- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.loader-ring {
  width: 42px;
  height: 42px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

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

/* ---- Error ---- */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(224, 90, 90, 0.08);
  border: 1px solid rgba(224, 90, 90, 0.25);
  border-radius: var(--radius-sm);
  color: #e88a8a;
  font-size: 0.88rem;
  padding: 0.85rem 1rem;
}

.error-banner svg { flex-shrink: 0; margin-top: 0.1rem; }

/* ---- Weather Bar ---- */
.weather-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
}

.weather-location {
  flex: 1;
  min-width: 160px;
}

.weather-location h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.weather-location .date {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.weather-stats {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.weather-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.weather-stat .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
}

.weather-stat .label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.weather-icon-desc {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.weather-icon-desc img {
  width: 40px;
  height: 40px;
}

/* ---- Scent Context ---- */
.scent-context {
  background: linear-gradient(135deg, var(--surface), #161622);
  border: 1px solid #2a2a40;
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  position: relative;
  overflow: hidden;
}

.scent-context::before {
  content: '"';
  position: absolute;
  top: -0.3rem;
  left: 0.75rem;
  font-size: 4rem;
  color: var(--gold-glow);
  font-family: Georgia, serif;
  line-height: 1;
}

.scent-context p {
  padding-left: 1.5rem;
}

/* ---- Recommendation Cards ---- */
.recommendations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

@media (max-width: 720px) {
  .recommendations-grid { grid-template-columns: 1fr; }
}

.rec-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.rec-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.rec-card:hover {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 1px var(--gold-glow), 0 8px 32px rgba(0,0,0,0.4);
}

.rec-card:hover::before { opacity: 1; }

.rec-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.rec-name-block { flex: 1; }

.rec-number {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.rec-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.rec-brand {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.rec-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
}

.tag-gender-men    { background: rgba(80,120,200,0.1); border-color: rgba(80,120,200,0.3); color: #8aaae8; }
.tag-gender-women  { background: rgba(200,100,160,0.1); border-color: rgba(200,100,160,0.3); color: #e8a0c8; }
.tag-gender-unisex { background: rgba(90,190,140,0.1); border-color: rgba(90,190,140,0.3); color: #80d4b0; }

.tag-price-budget   { background: rgba(90,185,100,0.08); border-color: rgba(90,185,100,0.25); color: #80c888; }
.tag-price-mid      { background: rgba(200,168,76,0.08); border-color: rgba(200,168,76,0.25); color: #c9a84c; }
.tag-price-luxury   { background: rgba(180,100,220,0.1); border-color: rgba(180,100,220,0.3); color: #c490e0; }

.rec-divider {
  height: 1px;
  background: var(--border);
  margin: 0.9rem 0;
}

.rec-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.rec-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.note-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.18rem 0.6rem;
}

.rec-why {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 0.9rem;
}

.rec-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rec-occasion {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ---- Refresh Row ---- */
.refresh-row {
  display: flex;
  justify-content: center;
  padding-top: 0.5rem;
}

/* ---- Footer ---- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  position: relative;
}

.site-footer a {
  color: var(--gold-dim);
  text-decoration: none;
  transition: color var(--transition);
}

.site-footer a:hover { color: var(--gold); }

/* ---- Lock button (admin trigger) ---- */
.lock-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.3rem;
  cursor: pointer;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  opacity: 0.35;
  transition: opacity var(--transition), color var(--transition), border-color var(--transition);
}

.lock-btn:hover {
  opacity: 1;
  color: var(--gold-dim);
  border-color: var(--border);
}

/* ---- Admin overlay ---- */
.admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.admin-overlay.visible {
  opacity: 1;
}

.admin-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.admin-modal-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.admin-modal-header h3 svg { color: var(--gold); }

.admin-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}

.admin-close:hover {
  color: var(--text);
  background: var(--surface-2);
}

#adminLockedView,
#adminUnlockedView {
  padding: 1.4rem;
}

.admin-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.admin-field {
  margin-bottom: 0.85rem;
}

.admin-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.admin-field input {
  width: 100%;
}

.admin-pw-error {
  font-size: 0.82rem;
  color: var(--error);
  margin-bottom: 0.75rem;
}

.admin-full-btn {
  width: 100%;
  justify-content: center;
}

/* ---- Admin status grid ---- */
.admin-status-grid {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.admin-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0;
}

.admin-key-row + .admin-key-row {
  border-top: 1px solid var(--border);
}

.admin-key-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.admin-key-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--success);
  font-family: monospace;
}

/* ---- Admin override details ---- */
.admin-override {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.admin-override summary {
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--transition), background var(--transition);
}

.admin-override summary::-webkit-details-marker { display: none; }

.admin-override summary::before {
  content: '›';
  display: inline-block;
  transition: transform 0.15s;
  color: var(--text-dim);
}

.admin-override[open] summary::before { transform: rotate(90deg); }

.admin-override summary:hover {
  color: var(--text);
  background: var(--surface-2);
}

.admin-override-note {
  font-size: 0.78rem;
  color: var(--text-dim);
  padding: 0 1rem 0.75rem;
  line-height: 1.5;
}

.admin-override .admin-field {
  padding: 0 1rem;
}

.admin-override .admin-full-btn {
  margin: 0 1rem 1rem;
  width: calc(100% - 2rem);
}

.admin-save-status {
  font-size: 0.82rem;
  color: var(--success);
  padding: 0 1rem 1rem;
}

/* ---- Links ---- */
a.link {
  color: var(--gold-dim);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  transition: color var(--transition);
}

a.link:hover { color: var(--gold); }

/* ---- Utility ---- */
[hidden] { display: none !important; }
