/* ============================================================
   Telekom Srbija · AI Marketing Strategist
   Design tokens
   ============================================================ */
:root{
  --bg: #120f19;
  --bg-alt: #171320;
  --panel: #1c1826;
  --panel-2: #241f30;
  --border: #322b40;
  --border-soft: #2a2434;

  --text: #f4f2f8;
  --text-muted: #a49dba;
  --text-faint: #6d6684;

  /* Telekom Srbija brand red (ne T-Mobile/DT magenta — Telekom Srbija ima sopstveni crveni identitet) */
  --magenta: #e2122e;
  --magenta-light: #ff5468;
  --magenta-dark: #7c0d1e;
  --magenta-glow: rgba(226, 18, 46, 0.35);

  --platinum-1:#eef1f9; --platinum-2:#9aa4bd;
  --gold-1:#f7dd93;     --gold-2:#b3812c;
  --silver-1:#e6e9f0;   --silver-2:#8790a1;
  --bronze-1:#e6a878;   --bronze-2:#8a4a24;

  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;

  --shadow-soft: 0 20px 50px -20px rgba(0,0,0,0.6);
}

*{ box-sizing: border-box; }
[hidden]{ display: none; }
html{ scroll-behavior: smooth; }

body{
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

.sr-only{
  position: absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip: rect(0,0,0,0); white-space:nowrap; border:0;
}

/* ambient glow, restrained */
.bg-glow{ position: fixed; border-radius: 50%; filter: blur(90px); pointer-events:none; z-index:0; opacity:0.5;}
.bg-glow--a{ width: 520px; height: 520px; top:-220px; right:-160px; background: radial-gradient(circle, var(--magenta-glow), transparent 70%); }
.bg-glow--b{ width: 420px; height: 420px; bottom:-200px; left:-140px; background: radial-gradient(circle, rgba(140,30,20,0.24), transparent 70%); }

/* ============================================================
   Topbar
   ============================================================ */
.topbar{
  position: relative; z-index: 2;
  display:flex; align-items:center; justify-content:space-between;
  padding: 22px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar__brand{ display:flex; align-items:center; gap:14px; }
.brand-mark{
  display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; border-radius: 12px;
  background: linear-gradient(135deg, var(--magenta), var(--magenta-dark));
  color:#fff; font-family: var(--font-display); font-weight:700; font-size:14px;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px -6px var(--magenta-glow);
}
.brand-copy{ display:flex; flex-direction:column; line-height:1.25; }
.brand-copy strong{ font-family: var(--font-display); font-size:16px; font-weight:600; }
.brand-copy span{ font-size:12.5px; color: var(--text-muted); }

.icon-btn{
  width:40px; height:40px; border-radius:10px;
  border:1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition: all .18s ease;
}
.icon-btn svg{ width:19px; height:19px; }
.icon-btn:hover{ color: var(--text); border-color: var(--magenta); box-shadow: 0 0 0 3px var(--magenta-glow); }

/* ============================================================
   Layout
   ============================================================ */
.layout{
  position: relative; z-index:1;
  display:grid;
  grid-template-columns: minmax(340px, 360px) 1fr;
  gap: 28px;
  padding: 36px clamp(20px, 4vw, 56px) 80px;
  max-width: 1320px;
  margin: 0 auto;
  align-items: start;
}

.panel{
  background: linear-gradient(180deg, var(--panel), var(--bg-alt));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-soft);
  height: 100%;

}

.eyebrow{
  margin:0 0 8px;
  font-size: 12px; font-weight:600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--magenta-light);
}
.brief h1{
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 30px);
  margin: 0 0 10px;
  font-weight: 600;
}
.lede{
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0 0 30px;
}

/* ============================================================
   Form fields
   ============================================================ */
.field-block{ margin-bottom: 26px; }
.field-label{
  display:block; font-size: 13px; font-weight:600; color: var(--text);
  margin-bottom: 10px;
}
.field-label-row{ display:flex; align-items:center; justify-content:space-between; }
.char-count{ font-size: 12px; color: var(--text-faint); }

.field-error{
  display:none; margin: 8px 0 0; font-size: 12.5px; color: #ff7aa8;
}
.field-error.show{ display:block; }

textarea, input[type="text"]{
  width:100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 13px 15px;
  resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea::placeholder, input::placeholder{ color: var(--text-faint); }
textarea:focus, input:focus{
  outline: none;
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px var(--magenta-glow);
}

/* (tier selector removed from brief form — kategorija se sada dobija iz AI odgovora) */

/* ============================================================
   Buttons
   ============================================================ */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family: var(--font-body); font-weight:600; font-size: 14.5px;
  border-radius: var(--radius-sm);
  padding: 13px 20px;
  border: 1px solid transparent;
  cursor:pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:active{ transform: scale(0.98); }
.btn--full{ width:100%; }
.btn--small{ padding: 10px 14px; font-size: 13px; }

.btn--primary{
  background: linear-gradient(135deg, var(--magenta), var(--magenta-dark));
  color:#fff;
  box-shadow: 0 12px 26px -12px var(--magenta-glow);
}
.btn--primary:hover{ box-shadow: 0 14px 30px -10px var(--magenta-glow); }
.btn--primary:disabled{ opacity: 0.6; cursor: not-allowed; transform:none; }

.btn--ghost{
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover{ border-color: var(--magenta); color: var(--magenta-light); }

.btn-icon{ width:16px; height:16px; transition: transform .18s ease; }
#submitBtn:hover .btn-icon{ transform: translateX(3px); }
.btn-spinner{ display:none; width:16px; height:16px; border-radius:50%; border: 2px solid rgba(255,255,255,0.4); border-top-color:#fff; animation: spin .7s linear infinite; }
#submitBtn.is-loading .btn-label{ opacity: 0.6; }
#submitBtn.is-loading .btn-icon{ display:none; }
#submitBtn.is-loading .btn-spinner{ display:inline-block; }
@keyframes spin{ to{ transform: rotate(360deg); } }

.form-error{
  display:none; margin: 14px 0 0; font-size: 13px; color: #ff7aa8;
  background: rgba(226,0,122,0.08); border:1px solid rgba(226,0,122,0.25);
  padding: 10px 14px; border-radius: var(--radius-sm);
}
.form-error.show{ display:block; }

/* ============================================================
   Preview column
   ============================================================ */
.preview{
  position: sticky; top: 24px;
  display:flex; flex-direction:column; align-items:center;
}
.preview .eyebrow{ align-self:flex-start; }

.phone{
  position: relative;
  width: 360px;
  border-radius: 38px;
  background: linear-gradient(160deg, #26202f, #14111c);
  border: 1px solid var(--border-soft);
  padding: 12px;
  box-shadow: var(--shadow-soft), inset 0 0 0 1px rgba(255,255,255,0.03);
}
.phone__notch{
  position:absolute; top:12px; left:50%; transform: translateX(-50%);
  width: 90px; height: 20px; background: #0d0b12; border-radius: 12px; z-index:2;
}
.phone__screen{
  background: #000;
  border-radius: 28px;
  overflow:hidden;
  padding-top: 26px;
}

.ig-post{ background: #0b0b0d; color:#f2f2f2; font-family: var(--font-body); }
.ig-post__header{
  display:flex; align-items:center; gap:9px; padding: 10px 12px;
}
.ig-avatar{
  width:30px; height:30px; border-radius:50%;
  background: linear-gradient(135deg, var(--magenta), #4a0812);
  display:flex; align-items:center; justify-content:center;
  font-size:9px; font-weight:700; color:#fff; font-family: var(--font-display);
}
.ig-header-copy{ display:flex; flex-direction:column; line-height:1.25; flex:1; }
.ig-header-copy strong{ font-size:12.5px; }
.ig-header-copy span{ font-size:10.5px; color:#9a9a9a; }
.ig-dots{ width:16px; height:16px; color:#c9c9c9; }

.ig-image{
  position:relative; width:100%; aspect-ratio: 1/1;
  background: linear-gradient(160deg, #201c28, #131018);
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
.ig-image img{ width:100%; height:100%; object-fit: cover; display:block; }
.ig-image__empty{
  display:flex; flex-direction:column; align-items:center; gap:8px;
  color: var(--text-faint); font-size: 11.5px; text-align:center; padding: 0 30px;
}
.ig-image__empty svg{ width:34px; height:34px; opacity:0.6; }
.ig-image__loading{
  position:absolute; inset:0; display:none; align-items:center; justify-content:center; gap:6px;
  background: rgba(10,8,14,0.65);
}
.ig-image__loading:not([hidden]){
  display:flex;
}
.pulse-dot{ width:7px; height:7px; border-radius:50%; background: var(--magenta-light); animation: pulse 1s ease-in-out infinite; }
.pulse-dot:nth-child(2){ animation-delay: .15s; } .pulse-dot:nth-child(3){ animation-delay: .3s; }
@keyframes pulse{ 0%,100%{ opacity:.25; transform: scale(0.85);} 50%{ opacity:1; transform: scale(1);} }

.ig-actions{
  display:flex; align-items:center; gap:14px; padding: 11px 12px 4px;
}
.ig-actions svg{ width:21px; height:21px; }
.ig-bookmark{ margin-left:auto; }

.ig-caption{
  padding: 6px 12px 16px;
  font-size: 12.5px; line-height:1.5;
}
.ig-caption strong{ margin-right:6px; }
.ig-caption__title{ font-weight:600; display:block; margin-top:4px; }
.ig-caption__desc{ margin: 4px 0 6px; color:#d6d6d6; white-space: pre-wrap; }
.ig-caption__tags{ margin:0; color: #6fb1ff; word-break: break-word; }
.ig-caption__tags:empty{ display:none; }

/* ============================================================
   Result editor
   ============================================================ */
.result-editor{
  width: 100%;
  max-width: 420px;
  margin-top: 26px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.result-editor__head{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom: 18px;
}
.result-editor__head h3{
  font-family: var(--font-display); font-size:16px; margin:0; font-weight:600;
}
.badge-tier{
  font-size: 11px; font-weight:700; letter-spacing:0.04em; text-transform:uppercase;
  padding: 5px 11px; border-radius: 999px;
  color: #17131f;
}
.badge-tier[data-tier="Platinum"]{ background: linear-gradient(135deg, var(--platinum-1), var(--platinum-2)); }
.badge-tier[data-tier="Gold"]{ background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); }
.badge-tier[data-tier="Silver"]{ background: linear-gradient(135deg, var(--silver-1), var(--silver-2)); }
.badge-tier[data-tier="Bronze"]{ background: linear-gradient(135deg, var(--bronze-1), var(--bronze-2)); color:#fff; }

/* AI-predložena kategorija, editabilna kroz select */
.tier-result{
  display:inline-flex; align-items:center; gap:8px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
.tier-dot{
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.tier-result[data-tier="Platinum"] .tier-dot{ background: linear-gradient(135deg, var(--platinum-1), var(--platinum-2)); }
.tier-result[data-tier="Gold"] .tier-dot{ background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); }
.tier-result[data-tier="Silver"] .tier-dot{ background: linear-gradient(135deg, var(--silver-1), var(--silver-2)); }
.tier-result[data-tier="Bronze"] .tier-dot{ background: linear-gradient(135deg, var(--bronze-1), var(--bronze-2)); }

.tier-result select{
  appearance: none; -webkit-appearance:none; -moz-appearance:none;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding-right: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a49dba' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 13px;
}
.tier-result select:focus{ outline: none; }
.tier-result select option{ background: var(--panel); color: var(--text); }

.tier-result-hint{
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

.result-editor .field-label{ margin-top: 16px; }
.result-editor .field-label:first-of-type{ margin-top: 0; }

.image-edit-row{ display:flex; gap:8px; }
.image-edit-row input{ flex:1; }

.result-actions{
  display:flex; flex-wrap:wrap; gap:10px; margin-top: 22px;
}

.copy-toast{
  opacity:0; transform: translateY(4px);
  transition: all .25s ease;
  margin: 12px 0 0; font-size:12.5px; color: #7be0a4; text-align:center;
}
.copy-toast.show{ opacity:1; transform:none; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay{
  position: fixed; inset:0; z-index: 50;
  background: rgba(8,6,12,0.65);
  backdrop-filter: blur(4px);
  display:flex; align-items:center; justify-content:center;
  padding: 20px;
}
.modal{
  width: 100%; max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-soft);
}
.modal h3{ font-family: var(--font-display); margin: 0 0 8px; font-size:18px; }
.modal-lede{ color: var(--text-muted); font-size:13.5px; line-height:1.5; margin: 0 0 18px; }
.modal input{ margin-bottom: 6px; }
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top: 18px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .preview{ position: static; }
  .phone{ width: min(340px, 84vw); }
}
@media (max-width: 520px){
  .panel{ padding: 22px; }
  .result-actions .btn{ flex:1; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  html{ scroll-behavior: auto; }
}
