/**
 * Taahhütname Otomasyonu & Arşiv Yönetim Sistemi - Ana Tasarım Sistemi
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* Renk Paleti - Karanlık Mod (Varsayılan) */
  --bg-main: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-hover: rgba(31, 41, 55, 0.95);
  --bg-input: #1f2937;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-primary: #3b82f6;
  --accent-primary-hover: #2563eb;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --accent-glow: 0 0 20px rgba(59, 130, 246, 0.35);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.5);

  --paper-bg: #525659;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', sans-serif;
}

[data-theme="light"] {
  --bg-main: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #f9fafb;
  --bg-input: #f9fafb;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: #2563eb;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-gradient: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  --accent-glow: 0 4px 14px rgba(37, 99, 235, 0.25);

  --paper-bg: #e5e7eb;
}

/* Genel Sıfırlama */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-ui);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==============================================
   ÜST BAŞLIK & NAVİGASYON (HEADER)
   ============================================== */
.app-header {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 1.5rem;
}

.header-container {
  max-width: 1700px;
  margin: 0 auto;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--accent-glow);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Sekmeler */
.app-navigation {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.15);
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tab-archive-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  margin-left: 5px;
  line-height: 1;
}

.nav-tab-btn:not(.active) .tab-archive-badge {
  background: var(--accent-gradient);
  color: #ffffff;
}

/* Başlık Sağ Araçları */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon-toggle {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-toggle:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* ==============================================
   ANA İÇERİK & GÖRÜNÜM GEÇİŞLERİ
   ============================================== */
.app-main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-view {
  display: none;
  flex: 1;
}

.app-view.active {
  display: flex;
  flex-direction: column;
}

/* ==============================================
   1. EDİTÖR / BÖLÜNMÜŞ GÖRÜNÜM (SPLIT LAYOUT)
   ============================================== */
.editor-split-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 68px);
}

/* Sol Kolon: Form Alanları */
.editor-form-col {
  width: 480px;
  min-width: 440px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 68px);
  position: sticky;
  top: 68px;
}

.form-col-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
}

.template-selector-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.selector-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.template-badge-pill {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--success-bg);
  color: var(--success);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.custom-select {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.custom-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* Form Elemanları */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.required-star {
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 0.68rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  transition: all 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-control::placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
}

textarea.form-control {
  resize: vertical;
  line-height: 1.5;
}

input[type="date"].form-control {
  color-scheme: dark;
  cursor: pointer;
  padding: 0.6rem 0.85rem;
}

[data-theme="light"] input[type="date"].form-control {
  color-scheme: light;
}

.form-row-2col,
.form-row-3col {
  width: 100%;
}

.form-row-2col select,
.form-row-3col input {
  font-size: 0.82rem;
}

.form-col-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Butonlar */
.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Sağ Kolon: A4 Belge Önizleme Sahnesi */
.editor-preview-col {
  flex: 1;
  background-color: var(--paper-bg);
  overflow-y: auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Üst Yüzen Aksiyon Çubuğu */
.preview-actions-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.preview-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.btn-action-primary {
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-full);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  transition: all 0.2s;
}

.btn-action-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-action-docx {
  background: linear-gradient(135deg, #2b579a 0%, #1b3a6b 100%);
  border: none;
  color: #ffffff;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(43, 87, 154, 0.4);
  transition: all 0.2s;
}

.btn-action-docx:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-action-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s;
}

.btn-action-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-zoom-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}

.btn-zoom-toggle:hover {
  color: var(--text-primary);
  border-color: var(--accent-color);
  background: rgba(59, 130, 246, 0.12);
}

.btn-zoom-toggle.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.a4-document-container.scaled-fit {
  transform: scale(0.84);
  margin-bottom: -150px;
}

/* ==============================================
   2. ARŞİV GÖRÜNÜMÜ & TABLO
   ============================================== */
.archive-view-container {
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.archive-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.archive-title-group h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.archive-title-group p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.archive-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-box-wrapper {
  position: relative;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 0.65rem 0.9rem 0.65rem 2.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--border-focus);
}

/* Arşiv Tablosu */
.archive-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.archive-data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.archive-data-table thead {
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.archive-data-table th {
  padding: 1rem 1.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.archive-data-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

.archive-data-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.archive-data-table td {
  padding: 1.1rem 1.25rem;
  vertical-align: middle;
}

.date-badge {
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.template-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
  white-space: nowrap;
}

.idare-text {
  display: inline-block;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

.details-text {
  color: var(--text-muted);
  display: block;
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-btn-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-action-icon {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-action-icon:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.15);
}

.btn-action-icon.btn-delete:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  margin-bottom: 1rem;
  opacity: 0.4;
}

/* ==============================================
   3. MÜELLİF BİLGİLERİ & İMZA STÜDYOSU
   ============================================== */
.profile-view-container {
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.profile-header-title {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.profile-header-title h2 {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 700;
}

.profile-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 992px) {
  .profile-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Profil Türü Seçici (Müellif / Müteahhit) */
.profile-type-switcher {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: 0.5rem;
}

.profile-type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.profile-type-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.profile-type-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: var(--shadow-md);
}

.card-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.card-title-group h3 {
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* İmza Stüdyosu */
.signature-studio-box {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.canvas-wrapper {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 2px dashed #9ca3af;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}

#signaturePad {
  width: 100%;
  height: 170px;
  touch-action: none;
  cursor: crosshair;
}

/* Fixed CSS box; signature.js keeps a 2x backing store and maps pointer
   coordinates through getBoundingClientRect, so the box may shrink freely. */
.signature-canvas-container {
  position: relative;
  width: 480px;
  max-width: 100%;
}

#signatureCanvas {
  display: block;
  width: 480px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 480 / 180;
  background: #ffffff;
  border: 2px dashed #9ca3af;
  border-radius: var(--radius-md);
  box-sizing: border-box;
  touch-action: none;
  cursor: crosshair;
}

.canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: #6b7280;
  pointer-events: none;
}

.canvas-placeholder[hidden] {
  display: none;
}

.signature-tools-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tool-btn-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sig-upload-zone {
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.saved-signature-display {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 1rem;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#savedSignaturePreview {
  max-height: 70px;
  max-width: 100%;
  object-fit: contain;
  display: none;
}

.sig-empty-notice {
  font-size: 0.85rem;
  color: #6b7280;
  font-style: italic;
}

/* ==============================================
   4. ŞABLONLAR REHBERİ GÖRÜNÜMÜ
   ============================================== */
.templates-view-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.75rem;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.template-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

/* ==============================================
   BİLDİRİM VE YÜKLENİYOR MODALI (TOAST & OVERLAY)
   ============================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  background: #1f2937;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  animation: toastSlideIn 0.25s ease-out;
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-info {
  border-left: 4px solid var(--accent-primary);
}

.toast-fade-out {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease-out;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.25rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ==============================================
   FORM İÇİ İMZA ALANI (JPEG / PNG) KARTI
   ============================================== */
.form-signature-card {
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-sig-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-sig-header label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sig-status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(156, 163, 175, 0.15);
  color: var(--text-muted);
}

.sig-status-badge.active {
  background: var(--success-bg);
  color: var(--success);
}

.form-sig-content {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.form-sig-preview-frame {
  width: 120px;
  height: 52px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 3px;
  flex-shrink: 0;
}

.form-sig-preview-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.no-sig-text {
  font-size: 0.75rem;
  color: #9ca3af;
  font-style: italic;
}

.form-sig-btn-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.btn-sm {
  padding: 0.38rem 0.7rem !important;
  font-size: 0.78rem !important;
}

.btn-xs {
  padding: 0.22rem 0.5rem !important;
  font-size: 0.72rem !important;
  border-radius: var(--radius-sm) !important;
}

.btn-preset-scale {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-preset-scale:hover,
.btn-preset-scale.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.form-sig-scale-section {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
}

.badge-scale {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
}

.sig-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 4px;
  outline: none;
  border: 1px solid var(--border-color);
}

.sig-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
  transition: transform 0.1s;
}

.sig-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* Sürükle & Bırak İmza Konumu Stilleri */
.btn-nudge-pos {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-nudge-pos:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.btn-reset-pos {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s;
}

.btn-reset-pos:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #ef4444;
}

.draggable-signature-container {
  display: inline-block;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 4px;
  position: relative;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
}

.draggable-signature-container:hover {
  outline: 1.5px dashed rgba(0, 32, 96, 0.45);
  background: rgba(0, 32, 96, 0.02);
}

.draggable-signature-container:hover .drag-hint-badge {
  opacity: 1;
  transform: translateY(0);
}

.draggable-signature-container.is-dragging {
  cursor: grabbing !important;
  outline: 2px dashed #002060 !important;
  box-shadow: 0 6px 16px rgba(0, 32, 96, 0.22);
  z-index: 50;
  background: rgba(0, 32, 96, 0.05);
}

.draggable-signature-container.is-dragging .drag-hint-badge {
  opacity: 1;
  transform: translateY(0);
  background: #2563eb;
}

.drag-hint-badge {
  position: absolute;
  top: -19px;
  right: 0;
  background: #002060;
  color: #ffffff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transform: translateY(3px);
  transition: all 0.15s ease;
  pointer-events: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}

/* ==============================================
   GÜVENLİK GİRİŞ EKRANI (LOGIN OVERLAY) STİLLERİ
   ============================================== */
body.auth-locked {
  overflow: hidden !important;
}

.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(10, 15, 29, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-lg, 16px);
  padding: 2.2rem 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  animation: loginFadeIn 0.3s ease-out;
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-brand-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.login-icon-box {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
  margin-bottom: 0.25rem;
}

.login-brand-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  margin: 0;
}

.login-brand-header p {
  font-size: 0.85rem;
  color: var(--text-secondary, #94a3b8);
  margin: 0;
  line-height: 1.4;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.login-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-wrapper input {
  padding-right: 44px;
  height: 46px;
  font-size: 0.95rem;
  border-radius: 10px;
}

.btn-toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.btn-toggle-pw:hover {
  color: var(--text-primary, #ffffff);
}

.login-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.remember-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary, #94a3b8);
  cursor: pointer;
  user-select: none;
}

.remember-label input[type="checkbox"] {
  accent-color: #2563eb;
  cursor: pointer;
}

.btn-login-submit {
  height: 46px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-login-submit:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn-login-submit:active {
  transform: translateY(0);
}

.login-error-alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
}

.shake-animation {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* Header Çıkış Butonu */
.btn-logout-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-logout-header:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.45);
  color: #ef4444;
}

/* ==============================================
   WHATSAPP FORMAT SEÇİM MODALI
   ============================================== */
.app-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(10, 15, 29, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: modalOverlayFade 0.2s ease-out;
}

@keyframes modalOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.share-modal-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 18px;
  padding: 1.8rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: relative;
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.modal-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-icon-badge.whatsapp-bg {
  background: rgba(37, 211, 102, 0.12);
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.25);
}

.modal-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  margin: 0 0 0.2rem 0;
}

.modal-title-group p {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary, #ffffff);
}

.modal-body-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.format-option-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1.1rem 1.2rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1.5px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: inherit;
}

.format-option-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.format-option-card.format-pdf:hover {
  border-color: #f43f5e;
  box-shadow: 0 8px 24px rgba(244, 63, 94, 0.15);
}

.format-option-card.format-docx:hover {
  border-color: #3b82f6;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

.format-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.format-option-card:hover .format-card-icon {
  transform: scale(1.08);
}

.pdf-icon {
  background: rgba(244, 63, 94, 0.12);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

.docx-icon {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.format-card-content {
  flex: 1;
  min-width: 0;
}

.format-card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.format-card-title strong {
  font-size: 0.95rem;
  color: var(--text-primary, #ffffff);
  font-weight: 600;
}

.badge-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.tag-pdf {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.tag-docx {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.format-card-content p {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
  line-height: 1.35;
}

.format-card-arrow {
  color: var(--text-muted, #94a3b8);
  opacity: 0.5;
  transition: all 0.2s ease;
}

.format-option-card:hover .format-card-arrow {
  opacity: 1;
  transform: translateX(3px);
  color: var(--text-primary, #ffffff);
}

.format-text-only-btn {
  background: transparent;
  border: 1px dashed var(--border-color, rgba(255, 255, 255, 0.15));
  border-radius: 10px;
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 10px 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  margin-top: 0.2rem;
}

.format-text-only-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #ffffff);
  border-color: rgba(255, 255, 255, 0.3);
}

