/* frontend/css/styles.css — media-handler Design System */
/* Based on Shrimp Dev Brand Design */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Fonts */
  --font-display: 'Syne', sans-serif;
  --font-body:    'Crimson Pro', Georgia, serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Colors */
  --accent:       #ff6b35;
  --accent2:      #ff9f1c;
  --bg:           #0d0d0f;
  --bg2:          #141418;
  --bg3:          #1b1b21;
  --surface:      #1e1e26;
  --border:       #2a2a35;
  --text:         #e8e6f0;
  --muted:        #7a7890;
  --link:         #7eb8f7;

  /* Layout */
  --max:          1200px;
  --gap:          24px;
  --radius:       12px;
  --radius-sm:    8px;
  --sidebar-w:    220px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* Container */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ═══════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════ */
.navbar {
  background: rgba(13, 13, 15, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar__top {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gap);
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar__brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-shrink: 0;
  text-decoration: none;
}

.navbar__logo {
  font-size: 1.3rem;
}

.navbar__name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.navbar__name em {
  font-style: normal;
  color: var(--accent);
}

.navbar__slogan {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 4px;
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  flex-wrap: nowrap;
  overflow: hidden;
}

.navbar__link {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.navbar__link:hover {
  color: var(--text);
  background: var(--surface);
}

.navbar__link--highlight {
  color: var(--accent);
  border: 1px solid rgba(255, 107, 53, 0.3);
}

.navbar__link--highlight:hover {
  background: rgba(255, 107, 53, 0.1);
}

.navbar__tags {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px var(--gap);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}

/* ═══════════════════════════════════════════════════
   AD CONTAINERS (Adsterra)
   ═══════════════════════════════════════════════════ */
.ad-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  overflow: hidden;
}

.ad-container--banner {
  max-width: 728px;
  min-height: 90px;
}

.ad-container--rectangle {
  max-width: 300px;
  min-height: 250px;
}

.ad-container--skyscraper {
  max-width: 160px;
  min-height: 600px;
}

.ad-container--mobile {
  max-width: 320px;
  min-height: 50px;
}

@media (max-width: 768px) {
  .ad-container--banner {
    max-width: 320px;
    min-height: 50px;
  }
  .ad-container--skyscraper {
    max-width: 160px;
    min-height: 300px;
  }
}

@media (max-width: 480px) {
  .ad-container {
    margin: 0 auto;
  }
}

/* ═══════════════════════════════════════════════════
   AD BANNERS (placeholders — deprecated)
   ═══════════════════════════════════════════════════ */
.ad-banner {
  background: var(--bg3);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-family: var(--font-display);
  position: relative;
  overflow: hidden;
}

.ad-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.01) 10px,
    rgba(255, 255, 255, 0.01) 20px
  );
}

.ad-banner--horizontal {
  width: 100%;
  height: 90px;
}

.ad-banner--vertical {
  width: 100%;
  height: 400px;
}

.ad-banner__label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  background: var(--border);
  padding: 2px 6px;
  border-radius: 3px;
  position: relative;
}

.ad-banner__size {
  font-size: 0.85rem;
  font-weight: 600;
  position: relative;
}

.ad-banner__hint {
  font-size: 0.72rem;
  color: rgba(122, 120, 144, 0.6);
  position: relative;
}

/* Ad section spacing */
.ad-section {
  margin: 32px 0;
}

.ad-section--top {
  margin-top: 0;
  margin-bottom: 32px;
}

.ad-section--bottom {
  margin-top: 40px;
  margin-bottom: 0;
}

.ad-section--mid {
  margin: 40px 0;
}

/* ═══════════════════════════════════════════════════
   HEADER (Hero)
   ═══════════════════════════════════════════════════ */
.hero {
  padding: 48px 0 32px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero .subtitle {
  color: var(--muted);
  margin-top: 8px;
  font-size: 1.05rem;
}

/* ═══════════════════════════════════════════════════
   GRID + CARDS
   ═══════════════════════════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--gap);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card:hover {
  border-color: rgba(255, 107, 53, 0.4);
  transform: translateY(-2px);
}

.card .icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.card h2:hover {
  color: var(--accent);
}

.card p {
  color: var(--muted);
  font-size: 0.95rem;
  flex-grow: 1;
}

/* ═══════════════════════════════════════════════════
   TAG PILL / BADGE
   ═══════════════════════════════════════════════════ */
.tag-pill {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-block;
  align-self: flex-start;
}

.tag-pill:hover,
.tag-pill--active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(255, 107, 53, 0.08);
}

/* ═══════════════════════════════════════════════════
   LOADING
   ═══════════════════════════════════════════════════ */
.loading {
  text-align: center;
  padding: 60px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1rem;
}

/* ═══════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  margin-top: 60px;
}

.footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem var(--gap);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
}

.footer__brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 0.75rem;
}

.footer__logo {
  font-size: 1.2rem;
}

.footer__name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.footer__name em {
  font-style: normal;
  color: var(--accent);
}

.footer__desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

.footer__heading {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.footer__link {
  display: block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--muted);
  padding: 4px 0;
  transition: color 0.15s;
}

.footer__link:hover {
  color: var(--accent);
}

.footer__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.footer__bottom {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--gap);
  text-align: center;
  border-top: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--muted);
}

.footer__bottom a {
  color: var(--accent);
}

.footer__bottom a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════
   FUNCTION PAGE
   ═══════════════════════════════════════════════════ */
.func-layout {
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  gap: var(--gap);
  align-items: start;
}

.func-main {
  min-width: 0;
}

.func-sidebar {
  position: sticky;
  top: 80px;
}

.func-header {
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.func-header a.back {
  font-family: var(--font-display);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 16px;
  transition: color 0.15s;
}

.func-header a.back:hover {
  color: var(--accent);
}

.func-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.func-header h1 em {
  font-style: normal;
  color: var(--accent);
}

.func-header p {
  color: var(--muted);
  margin-top: 8px;
  font-size: 1.05rem;
}

/* ═══════════════════════════════════════════════════
   FORM
   ═══════════════════════════════════════════════════ */
.func-form {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group label {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-group textarea,
.form-group select,
.form-group input[type="file"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.12);
}

/* ═══════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════ */
.btn-primary {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}

.btn-primary:hover {
  background: #e55a2b;
  border-color: #e55a2b;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  cursor: pointer;
}

.btn-ghost:hover {
  background: rgba(255, 107, 53, 0.1);
}

/* ═══════════════════════════════════════════════════
   RESULT AREA
   ═══════════════════════════════════════════════════ */
.result {
  margin-top: 24px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: none;
}

.result.visible {
  display: block;
}

.result img,
.result video {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.result audio {
  width: 100%;
  margin-top: 12px;
}

.result .text-result {
  white-space: pre-wrap;
  background: var(--bg3);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
}

.result .error-msg {
  color: #ff6b6b;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
}

.result .success-msg {
  color: #34d399;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

/* ═══════════════════════════════════════════════════
   IMAGE PREVIEW
   ═══════════════════════════════════════════════════ */
#image-preview img {
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .func-layout {
    grid-template-columns: 1fr;
  }

  .func-sidebar {
    position: static;
    display: flex;
    flex-direction: row;
    gap: var(--gap);
    flex-wrap: wrap;
  }

  .func-sidebar .ad-banner--vertical {
    width: 100%;
    height: 90px;
  }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 1.8rem; }
  .grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
  .footer__inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .navbar__links { display: none; }
  .navbar__tags { display: none; }
}
