/**
 * SCOP — Reusable component styles (theme token’larını kullanır)
 */

/* ── App shell ───────────────────────────────────────────── */

.app {
  height: 100%;
  overflow: hidden;
  background: var(--color-workspace);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--font-normal);
  line-height: var(--line-height-body);
}

/* ── Typography utilities ────────────────────────────────── */

.mono,
.gtip-code,
.ref-code,
.mono-value {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.declaration-preview {
  font-family: var(--font-document);
  font-size: 8px;
  line-height: var(--line-height-document);
  color: #111111;
}

.label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
}

.card-title {
  font-size: var(--text-md);
  font-weight: var(--font-weight-semibold);
}

h1,
.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
}

h2,
.section-title {
  font-size: 18px;
  font-weight: var(--font-weight-semibold);
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  height: var(--btn-height);
  padding: 0 var(--btn-padding-x);
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-base);
  font-family: inherit;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.btn-primary {
  background: var(--color-brand-primary);
  color: var(--color-on-brand);
  box-shadow: var(--shadow-blue-glow);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-brand-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-brand-deep);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border-color: var(--color-border-light);
  box-shadow: none;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-surface-muted);
  color: var(--color-text-primary);
}

.btn:disabled,
.btn-disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
  border-color: transparent;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ── Sidebar items ───────────────────────────────────────── */

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text-dark-secondary);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-decoration: none;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  border-left: 3px solid transparent;
  transition: background 160ms ease, color 160ms ease;
}

.sidebar-item:hover:not(.is-disabled) {
  background: var(--color-sidebar-item-hover);
  color: var(--color-text-dark-primary);
}

.sidebar-item.active,
.sidebar-item.is-active {
  color: var(--color-text-dark-primary);
  background: var(--color-sidebar-item-active-bg);
  border-left-color: var(--color-brand-primary);
}

.sidebar-item.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.sidebar-section-label,
.nav-group-label {
  color: var(--color-sidebar-section-label);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Status badges ───────────────────────────────────────── */

.badge,
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--badge-height);
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1;
}

.badge--processing,
.badge-status--processing {
  color: var(--badge-processing-color);
  background: var(--badge-processing-bg);
  border-color: var(--badge-processing-border);
}

.badge--waiting-docs,
.badge-status--waiting-docs {
  color: var(--badge-waiting-docs-color);
  background: var(--badge-waiting-docs-bg);
  border-color: var(--badge-waiting-docs-border);
}

.badge--review,
.badge-status--review {
  color: var(--badge-review-color);
  background: var(--badge-review-bg);
  border-color: var(--badge-review-border);
}

.badge--completed,
.badge-status--success,
.badge-status--completed {
  color: var(--badge-completed-color);
  background: var(--badge-completed-bg);
  border-color: var(--badge-completed-border);
}

.badge--draft,
.badge-status--draft {
  color: var(--badge-draft-color);
  background: var(--badge-draft-bg);
  border-color: var(--badge-draft-border);
}

.badge--gtip-vergi,
.badge-status--gtip-vergi,
.badge-status--purple {
  color: var(--badge-gtip-vergi-color);
  background: var(--badge-gtip-vergi-bg);
  border-color: var(--badge-gtip-vergi-border);
}

.badge--declaration-ready,
.badge-status--declaration-ready {
  color: var(--badge-declaration-ready-color);
  background: var(--badge-declaration-ready-bg);
  border-color: var(--badge-declaration-ready-border);
}

.badge--error,
.badge-status--error {
  color: var(--color-error);
  background: var(--color-red-soft);
  border-color: #fecaca;
}

/* ── Cards ───────────────────────────────────────────────── */

.card,
.table-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

/* ── Tables ──────────────────────────────────────────────── */

.table,
.cases-table {
  width: 100%;
  border-collapse: collapse;
}

.table thead,
.cases-table thead {
  background: var(--color-surface-muted);
}

.table th,
.cases-table th {
  height: var(--table-header-height);
  padding: 0 14px;
  text-align: left;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border-light);
}

.table td,
.cases-table td {
  height: var(--table-row-height);
  padding: 0 14px;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.table tbody tr:hover td,
.cases-table tbody tr:hover td {
  background: var(--color-surface-muted);
}

.table tbody tr.selected td,
.cases-table tbody tr.selected td {
  background: var(--color-selected-row);
}

.table tbody tr.empty-row:hover td,
.cases-table tbody tr.empty-row:hover td {
  background: transparent;
}

/* ── Inputs ──────────────────────────────────────────────── */

.input,
.search-input {
  height: var(--input-height);
  padding: 0 12px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-base);
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.input::placeholder,
.search-input::placeholder {
  color: var(--color-text-muted);
}

.input:focus,
.search-input:focus {
  outline: none;
  border-color: var(--color-brand-primary);
  box-shadow: var(--focus-ring);
}

/* ── Detail panel ────────────────────────────────────────── */

.detail-panel {
  width: var(--panel-width);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.detail-panel-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--color-border-light);
}

.detail-panel-content {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.detail-panel-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
}

/* ── Dark modal / glass (menşe, AI odak ekranları) ───────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 100;
}

.dark-modal {
  background: linear-gradient(180deg, var(--color-dark-panel) 0%, var(--color-sidebar-end) 100%);
  color: var(--color-text-dark-primary);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}

.dark-modal .muted {
  color: var(--color-text-dark-muted);
}

.dark-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border-dark);
  color: var(--color-text-dark-primary);
  border-radius: var(--radius-sm);
  height: var(--input-height);
  padding: 0 12px;
  font-family: inherit;
}

.dark-glass-panel {
  background: var(--color-dark-glass);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  color: var(--color-text-dark-primary);
  backdrop-filter: blur(12px);
}

/* ── App dialog (confirm / alert) ─────────────────────────── */

body.scop-app-dialog-open {
  overflow: hidden;
}

#scop-app-dialog-root:empty {
  display: none;
}

.scop-app-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
}

.scop-app-dialog {
  position: relative;
  z-index: 1401;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: calc(100dvh - 36px);
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-modal, 0 24px 64px rgba(15, 23, 42, 0.22));
  color: var(--color-text-primary, #0f172a);
  overflow: hidden;
  animation: scop-app-dialog-in 0.16s ease-out;
}

@keyframes scop-app-dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.scop-app-dialog-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 0;
}

.scop-app-dialog-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.scop-app-dialog-icon svg {
  width: 20px;
  height: 20px;
}

.scop-app-dialog-icon--primary,
.scop-app-dialog-icon--info {
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.scop-app-dialog-icon--success {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.scop-app-dialog-icon--warning {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
}

.scop-app-dialog-icon--error {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.scop-app-dialog-header-text {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 8px;
}

.scop-app-dialog-title {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.scop-app-dialog-close {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-secondary, #64748b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.scop-app-dialog-close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--color-text-primary, #0f172a);
}

.scop-app-dialog-close svg {
  width: 16px;
  height: 16px;
}

.scop-app-dialog-body {
  min-height: 0;
  overflow-y: auto;
  padding: 10px 18px 4px 70px;
}

.scop-app-dialog-p {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-secondary, #475569);
}

.scop-app-dialog-p:last-child {
  margin-bottom: 0;
}

.scop-app-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 18px 18px;
}

.scop-app-dialog-footer .btn {
  justify-content: center;
  min-width: 96px;
}

.scop-app-dialog-btn-icon {
  display: inline-flex;
  margin-right: 6px;
  vertical-align: -2px;
}

.scop-app-dialog-btn-icon svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 520px) {
  .scop-app-dialog-body {
    padding-left: 18px;
  }

  .scop-app-dialog-footer {
    flex-direction: column-reverse;
  }

  .scop-app-dialog-footer .btn {
    width: 100%;
  }
}
