/* ===== Smart Trademark Examiner — Custom Styles ===== */

/* ---------- CSS Variables ---------- */
:root {
  --deep-blue: #1a202c;
  --navy: #0f172a;
  --slate: #64748b;
  --slate-light: #f1f5f9;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --surface: #f8fafc;
  --card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --border: #e2e8f0;
  --success: #10b981;
  --danger: #ef4444;
  --sidebar-w: 260px;
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: 'Inter', 'Cairo', sans-serif;
  scroll-behavior: smooth;
}

body {
  background: var(--surface);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Sidebar ---------- */
#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--deep-blue);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s cubic-bezier(.4, 0, .2, 1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, .15);
}

#sidebar .logo-area {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  text-align: center;
}

#sidebar .logo-area h1 {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .01em;
}

#sidebar .logo-area p {
  color: rgba(255, 255, 255, .6);
  font-size: .75rem;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

#sidebar nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  color: rgba(255, 255, 255, .7);
  cursor: pointer;
  transition: all .2s ease;
  border-right: 3px solid transparent;
  font-size: .92rem;
  font-weight: 500;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .04);
  color: #fff;
}

.nav-item.active {
  background: rgba(37, 99, 235, .15);
  color: #fff;
  border-right-color: var(--primary);
}

.nav-item svg {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

/* ---------- Main Content ---------- */
#main-content {
  margin-right: var(--sidebar-w);
  padding: 32px 40px;
  min-height: 100vh;
  transition: margin-right .35s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Page transitions ---------- */
.page {
  display: none;
}

.page.active-page {
  display: block;
  animation: pageIn .4s cubic-bezier(.4, 0, .2, 1);
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Card ---------- */
.card {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 28px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: box-shadow .2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, .06);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  border: none;
  transition: all .2s ease;
}

.btn-primary {
  background: var(--deep-blue);
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: var(--navy);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .15);
}

.btn-secondary {
  background: var(--slate-light);
  color: var(--deep-blue);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-outline {
  background: transparent;
  color: var(--deep-blue);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--slate-light);
  border-color: var(--slate);
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ---------- Upload Zone ---------- */
.upload-zone {
  border: 1px dashed var(--slate);
  border-radius: 8px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s ease;
  background: var(--surface);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, .04);
}

.upload-zone svg {
  margin: 0 auto 12px;
  color: var(--text-secondary);
}

/* ---------- Report ---------- */
.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, .02);
}

.report-card h3 {
  color: var(--deep-blue);
  font-size: 1.15rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-section {
  margin-bottom: 20px;
}

.report-section h4 {
  color: var(--slate);
  font-size: .9rem;
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.report-section p {
  color: var(--text-primary);
  line-height: 1.7;
  font-size: .95rem;
}

/* ---------- NICE table ---------- */
.nice-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.nice-table th {
  background: var(--slate-light);
  color: var(--deep-blue);
  padding: 12px 16px;
  font-weight: 600;
  font-size: .88rem;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--border);
}

.nice-table td {
  padding: 14px 16px;
  font-size: .92rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.nice-table tr:last-child td {
  border-bottom: none;
}

.nice-table tr:nth-child(even) {
  background: var(--surface);
}

.nice-table tr:hover td {
  background: var(--slate-light);
}

.nice-table .highlight {
  background: rgba(37, 99, 235, .06) !important;
}

/* ---------- Spinner ---------- */
.spinner {
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  stroke: currentColor;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--card);
  color: var(--text-primary);
  padding: 14px 20px;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -2px rgba(0, 0, 0, .05);
  border: 1px solid var(--border);
  border-left: 4px solid var(--deep-blue);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideIn .3s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut .3s ease 2.6s forwards;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastFadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ---------- Sortable ghost ---------- */
.sortable-ghost {
  opacity: .4;
}

.sortable-chosen {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}

/* ---------- Progress bar ---------- */
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--slate-light);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width .3s ease;
}

/* ---------- Comparison grid ---------- */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ---------- Mobile ---------- */
#menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  background: var(--deep-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  font-size: 1.2rem;
}

@media (max-width: 768px) {
  #menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #sidebar {
    transform: translateX(100%);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #main-content {
    margin-right: 0;
    padding: 24px 16px;
    padding-top: 68px;
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Print ---------- */
@media print {

  #sidebar,
  #menu-toggle,
  .no-print {
    display: none !important;
  }

  #main-content {
    margin: 0;
    padding: 20px;
  }

  .page {
    display: none !important;
  }

  .page.active-page {
    display: block !important;
  }

  .report-card {
    break-inside: avoid;
    border: 2px solid #333;
  }

  body {
    background: #fff;
  }
}

/* ---------- Misc ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.badge-gold {
  background: var(--slate-light);
  color: var(--slate);
  border: 1px solid var(--border);
}

.badge-blue {
  background: rgba(37, 99, 235, .1);
  color: var(--primary);
}

.badge-green {
  background: rgba(16, 185, 129, .1);
  color: var(--success);
}

.stat-card {
  text-align: center;
  padding: 20px;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--deep-blue);
}

.stat-card .stat-label {
  font-size: .82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.webhook-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: .9rem;
  direction: ltr;
  text-align: left;
  transition: all .2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .02);
}

.webhook-input:focus {
  outline: none;
  border-color: var(--deep-blue);
  box-shadow: 0 0 0 3px rgba(26, 32, 44, .1);
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .95rem;
  transition: all .2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .02);
}

.search-input:focus {
  outline: none;
  border-color: var(--deep-blue);
  box-shadow: 0 0 0 3px rgba(26, 32, 44, .1);
}

.img-preview {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.thumb-item {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: grab;
  transition: border-color .2s;
}

.thumb-item:hover {
  border-color: var(--primary);
}

.thumb-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.thumb-item .thumb-remove {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, .9);
  color: var(--danger);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all .2s;
}

.thumb-item:hover .thumb-remove {
  opacity: 1;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--deep-blue);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: .9rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.label {
  display: block;
  font-weight: 600;
  font-size: .85rem;
  color: var(--slate);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .88rem;
}

.file-info svg {
  flex-shrink: 0;
  color: var(--deep-blue);
}