/* Marketer's Desk — global styles */
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8edf4;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --accent2: #f59e0b;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface2);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--header-h);
  flex-wrap: wrap;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.logo:hover {
  color: var(--accent2);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: var(--surface2);
  border: none;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  margin-left: auto;
}

.main-nav {
  flex: 1;
}

.nav-list {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-link {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.2rem;
  text-decoration: none;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-switcher {
  position: relative;
}

.lang-current {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface2);
  border: 1px solid transparent;
  color: var(--text);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.lang-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
  min-width: 180px;
  z-index: 200;
}

.lang-dropdown.is-open {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 0.85rem;
}

.lang-option:hover,
.lang-option.is-active {
  background: var(--surface2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.btn:hover {
  filter: brightness(1.1);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--surface2);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
}

.btn-admin {
  font-size: 0.8rem;
  padding: 0.4rem 0.65rem;
}

/* Hero & desk */
.hero {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, var(--text), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 1.5rem;
}

.desk-scene {
  position: relative;
  margin: 2rem auto 3rem;
  max-width: 900px;
  aspect-ratio: 16 / 10;
  background: linear-gradient(180deg, #2d1f14 0%, #1a120c 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 3px solid #4a3728;
  overflow: hidden;
}

.desk-surface {
  position: absolute;
  inset: 12% 5% 8%;
  background: linear-gradient(145deg, #5c4033, #3d2817);
  border-radius: 8px;
  box-shadow: inset 0 2px 20px rgba(0, 0, 0, 0.4);
}

.desk-item {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem;
  background: rgba(26, 35, 50, 0.85);
  border: 2px solid var(--surface2);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  cursor: pointer;
  min-width: 90px;
  text-align: center;
  font-size: 0.8rem;
}

.desk-item:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
  border-color: var(--accent);
  text-decoration: none;
  color: var(--text);
}

.desk-item .icon {
  font-size: 2rem;
}

.desk-item--timer { top: 18%; left: 8%; }
.desk-item--text { top: 12%; left: 38%; }
.desk-item--pdf { top: 22%; right: 10%; }
.desk-item--utm { bottom: 28%; left: 15%; }
.desk-item--wm { bottom: 22%; right: 12%; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  padding: 2rem 0 3rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.tool-card .icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* Tool pages */
main.page-main {
  flex: 1;
  padding: 1.5rem 0 3rem;
}

.page-title {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.page-lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--surface2);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

input[type='text'],
input[type='url'],
input[type='password'],
input[type='number'],
input[type='color'],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--surface2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.field {
  flex: 1;
  min-width: 140px;
}

/* Timer */
.timer-display {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-variant-numeric: tabular-nums;
  text-align: center;
  margin: 1rem 0;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.timer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

#lap-list,
#timer-history {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
}

#lap-list li,
#timer-history li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--surface2);
  font-size: 0.9rem;
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
}

.metrics-grid dt {
  color: var(--muted);
}

.metrics-grid dd {
  margin: 0;
  font-weight: 600;
}

/* PDF drop */
.drop-zone {
  border: 2px dashed var(--surface2);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  transition: border-color 0.2s, background 0.2s;
}

.drop-zone.is-dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.pdf-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.pdf-thumb {
  position: relative;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.7rem;
  padding-bottom: 0.25rem;
}

.pdf-thumb img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.btn-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  border: none;
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
}

/* UTM */
#utm-qr {
  display: block;
  margin: 1rem auto;
  background: #fff;
  border-radius: 8px;
}

#utm-templates {
  list-style: none;
  padding: 0;
}

#utm-templates li {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

/* Watermark */
.wm-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1rem;
}

#wm-canvas {
  width: 100%;
  max-height: 60vh;
  border-radius: var(--radius);
  background: #111;
}

#wm-layers {
  list-style: none;
  padding: 0;
}

/* Admin */
.admin-body {
  background: #0a0e14;
}

.admin-login,
.admin-dashboard {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.admin-tabs button {
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--surface2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.admin-tabs button.is-active {
  background: var(--accent);
  border-color: var(--accent);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--surface2);
  padding: 0.4rem;
  text-align: left;
}

.ad-wrap:empty {
  display: none;
}

.ad-slot {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--surface2);
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-nav {
  display: flex;
  gap: 1rem;
}

/* RTL */
[dir='rtl'] .lang-dropdown {
  right: auto;
  left: 0;
}

[dir='rtl'] .header-inner {
  flex-direction: row-reverse;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .main-nav {
    display: none;
    width: 100%;
    order: 3;
  }

  .main-nav.is-open {
    display: block;
  }

  .nav-list {
    flex-direction: column;
  }

  .desk-item {
    min-width: 70px;
    padding: 0.5rem;
    font-size: 0.65rem;
  }

  .desk-item .icon {
    font-size: 1.4rem;
  }

  .wm-layout {
    grid-template-columns: 1fr;
  }
}
