/* ============================================================
   DocuForge — UI Sistemi
   ============================================================ */

:root {
  --brand:        #4F46E5;
  --brand-hover:  #4338CA;
  --brand-light:  #EEF2FF;
  --brand-dark:   #3730A3;

  --bg:           #F8F9FB;
  --surface:      #FFFFFF;
  --surface-2:    #F3F4F6;
  --border:       #E5E7EB;
  --border-dark:  #D1D5DB;

  --text-primary:   #111827;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;

  --success:      #10B981;
  --success-light:#D1FAE5;
  --warning:      #F59E0B;
  --warning-light:#FEF3C7;
  --danger:       #EF4444;
  --danger-light: #FEE2E2;
  --info:         #3B82F6;
  --info-light:   #DBEAFE;

  --sidebar-w:    240px;
  --topbar-h:     60px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg:    0 4px 16px rgba(0,0,0,.1);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0F1117;
    --surface:      #1A1D27;
    --surface-2:    #232635;
    --border:       #2E3348;
    --border-dark:  #3E4460;
    --text-primary:   #F1F3F9;
    --text-secondary: #9BA3BC;
    --text-muted:     #5C6485;
    --brand-light:  #2D2B63;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   LAYOUT
   ============================================================ */

.df-body {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.df-sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform .25s ease;
}

.df-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
}

.df-logo-icon { width: 32px; height: 32px; }
.df-logo-text { font-size: 17px; font-weight: 700; color: var(--text-primary); }

.df-sidebar__company {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.df-company-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.df-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 100px;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.df-role-superadmin   { background: #FDE68A; color: #78350F; }
.df-role-company_admin { background: var(--brand-light); color: var(--brand); }
.df-role-user         { background: var(--surface-2); color: var(--text-secondary); }

/* NAVIGATION */
.df-nav {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.df-nav__section {
  padding: 16px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
}

.df-nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
  text-decoration: none;
}

.df-nav__link svg { width: 16px; height: 16px; flex-shrink: 0; }

.df-nav__link:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  text-decoration: none;
}

.df-nav__item.active .df-nav__link,
.df-nav__link--active {
  background: var(--brand-light);
  color: var(--brand);
}

.df-nav__link--highlight {
  color: var(--brand);
  background: var(--brand-light);
  margin: 4px 8px;
  border-radius: var(--radius);
  padding: 9px 10px;
}

/* SIDEBAR BOTTOM */
.df-sidebar__bottom {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.df-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}

.df-avatar {
  width: 32px; height: 32px;
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.df-user-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.df-user-email {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.df-logout {
  padding: 6px;
  color: var(--text-muted);
  border-radius: var(--radius);
  display: flex;
  transition: color .15s, background .15s;
}

.df-logout:hover { color: var(--danger); background: var(--danger-light); text-decoration: none; }
.df-logout svg { width: 18px; height: 18px; }

/* MAIN */
.df-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOPBAR */
.df-topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.df-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
}

.df-sidebar-toggle svg { width: 22px; height: 22px; }

.df-page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.df-topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

/* Bildirim */
.df-notif-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text-secondary);
  border-radius: var(--radius);
  position: relative;
  transition: background .15s;
}

.df-notif-btn:hover { background: var(--surface-2); }
.df-notif-btn svg { width: 20px; height: 20px; }

.df-notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.df-notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.df-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.df-notif-list { max-height: 360px; overflow-y: auto; }
.df-notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

.df-notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}

.df-notif-item:hover { background: var(--surface-2); }
.df-notif-item.unread { background: var(--brand-light); }

.df-notif-item__title { font-size: 13px; font-weight: 600; }
.df-notif-item__body  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.df-notif-item__time  { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* CONTENT */
.df-content { padding: 24px; flex: 1; }

/* ============================================================
   AUTH LAYOUT
   ============================================================ */

.df-auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.df-auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.df-auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.df-auth-logo svg { width: 36px; height: 36px; }
.df-auth-logo span { font-size: 20px; font-weight: 700; }

.df-auth-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.df-auth-sub   { color: var(--text-secondary); font-size: 13.5px; margin-bottom: 28px; }

/* ============================================================
   FORM ELEMENLERİ
   ============================================================ */

.df-form-group { margin-bottom: 16px; }

.df-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.df-label .required { color: var(--danger); margin-left: 2px; }

.df-input,
.df-select,
.df-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.df-input:focus,
.df-select:focus,
.df-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

.df-input::placeholder { color: var(--text-muted); }
.df-textarea { resize: vertical; min-height: 80px; }
.df-select { cursor: pointer; }

.df-input-help { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   BUTONLAR
   ============================================================ */

.df-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}

.df-btn svg { width: 15px; height: 15px; }

.df-btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.df-btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  text-decoration: none;
  color: #fff;
}

.df-btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-dark);
}

.df-btn-secondary:hover { background: var(--surface-2); text-decoration: none; }

.df-btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: transparent;
}

.df-btn-danger:hover { background: var(--danger); color: #fff; text-decoration: none; }

.df-btn-success {
  background: var(--success);
  color: #fff;
}

.df-btn-success:hover { opacity: .9; text-decoration: none; color: #fff; }

.df-btn-text {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}

.df-btn-text:hover { text-decoration: underline; }

.df-btn-sm { padding: 5px 12px; font-size: 12px; }
.df-btn-lg { padding: 12px 24px; font-size: 15px; }
.df-btn-full { width: 100%; }

.df-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   KARTLAR
   ============================================================ */

.df-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.df-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.df-card-title { font-size: 15px; font-weight: 600; }
.df-card-body  { padding: 20px; }
.df-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ============================================================
   TABLO
   ============================================================ */

.df-table-wrap { overflow-x: auto; }

.df-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.df-table th {
  background: var(--surface-2);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.df-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.df-table tr:last-child td { border-bottom: none; }
.df-table tr:hover td { background: var(--surface-2); }

/* ============================================================
   ALERT / FLASH
   ============================================================ */

.df-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 0 24px 16px;
  font-size: 13.5px;
}

.df-alert__close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  opacity: .6;
  color: inherit;
}

.df-alert__close:hover { opacity: 1; }

.df-alert--success { background: var(--success-light); color: #065F46; }
.df-alert--error   { background: var(--danger-light);  color: #991B1B; }
.df-alert--info    { background: var(--info-light);    color: #1E40AF; }
.df-alert--warning { background: var(--warning-light); color: #78350F; }

/* ============================================================
   BADGE / STATüLER
   ============================================================ */

.df-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.df-badge-success { background: var(--success-light); color: #065F46; }
.df-badge-danger  { background: var(--danger-light);  color: #991B1B; }
.df-badge-warning { background: var(--warning-light); color: #78350F; }
.df-badge-info    { background: var(--info-light);    color: #1E40AF; }
.df-badge-gray    { background: var(--surface-2);     color: var(--text-secondary); }
.df-badge-brand   { background: var(--brand-light);   color: var(--brand); }

/* ============================================================
   DÜZELTME FORMU (Çeviri modali)
   ============================================================ */

.df-correction-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all .15s;
}

.df-correction-trigger:hover {
  background: var(--warning-light);
  color: #78350F;
}

.df-correction-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.df-correction-modal__box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
}

.df-correction-modal__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.df-correction-modal__sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.df-correction-source {
  background: var(--surface-2);
  border-left: 3px solid var(--border-dark);
  padding: 10px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
  margin-bottom: 16px;
}

.df-source-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ============================================================
   UPLOAD ALANI
   ============================================================ */

.df-dropzone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
}

.df-dropzone:hover,
.df-dropzone.active {
  border-color: var(--brand);
  background: var(--brand-light);
}

.df-dropzone__icon { font-size: 40px; margin-bottom: 12px; }
.df-dropzone__title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.df-dropzone__sub   { color: var(--text-secondary); font-size: 13px; }

/* ============================================================
   PROGRESS / LOADING
   ============================================================ */

.df-progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 100px;
  overflow: hidden;
}

.df-progress__bar {
  height: 100%;
  background: var(--brand);
  border-radius: 100px;
  transition: width .3s ease;
}

.df-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ============================================================
   GRID & LAYOUT UTILITY
   ============================================================ */

.df-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.df-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.df-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

.df-flex   { display: flex; }
.df-flex-c { display: flex; align-items: center; }
.df-flex-b { display: flex; align-items: center; justify-content: space-between; }
.df-gap-8  { gap: 8px; }
.df-gap-16 { gap: 16px; }
.df-mt-16  { margin-top: 16px; }
.df-mt-24  { margin-top: 24px; }
.df-mb-16  { margin-bottom: 16px; }

.df-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.df-empty__icon { font-size: 48px; margin-bottom: 12px; }
.df-empty__title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.df-empty__sub   { font-size: 13px; margin-bottom: 20px; }

/* ============================================================
   PAGINATION
   ============================================================ */

.df-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
}

.df-page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-primary);
  transition: all .15s;
  text-decoration: none;
}

.df-page-btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.df-page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.df-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .df-sidebar {
    transform: translateX(-100%);
  }

  .df-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .df-main { margin-left: 0; }
  .df-sidebar-toggle { display: flex; }
  .df-grid-2, .df-grid-3, .df-grid-4 { grid-template-columns: 1fr; }
  .df-content { padding: 16px; }
}

/* ============================================================
   EK STİLLER (eksik sınıflar)
   ============================================================ */

/* Uyarı butonu */
.df-btn-warning {
  background: var(--warning-light);
  color: #78350F;
  border-color: transparent;
}
.df-btn-warning:hover { background: var(--warning); color: #fff; text-decoration: none; }

/* Tab butonları */
.df-tab-btn {
  padding: 9px 20px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all .15s;
}
.df-tab-btn.active {
  background: var(--brand);
  color: #fff;
}

/* Kullanıcı bilgi alanı */
.df-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

/* Modal overlay animasyonu */
.df-correction-modal {
  animation: fadeIn .15s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Sticky pos düzeltme - editor için */
.df-editor-sticky {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

/* Akıllı tablo - küçük ekranlarda scroll */
@media (max-width: 1024px) {
  .df-grid-3, .df-grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}
