:root {
  --bg-color: #f1f5f9;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --sidebar-width: 280px;
  --accent-color: #e11d48;
  /* Premium Crimson */
  --accent-soft: rgba(225, 29, 72, 0.08);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  background-image:
    radial-gradient(at 0% 0%, rgba(225, 29, 72, 0.03) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(241, 245, 249, 1) 0px, transparent 50%);
  display: flex;
  min-height: 100vh;
  color: var(--text-main);
}

/* Sidebar Tasarımı */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  margin: 20px;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  padding: 35px 20px;
  box-shadow:
    var(--shadow-lg),
    0 0 5px rgba(225, 29, 72, 0.2),
    0 0 15px rgba(225, 29, 72, 0.1);
  /* Neo Layered Glow */
  border: 1.5px solid rgba(225, 29, 72, 0.8);
  /* Neo Crimson Frame */
  transition: var(--transition);
  position: fixed;
  /* FIXED SIDEBAR */
  height: calc(100vh - 40px);
  z-index: 1000;
  overflow: hidden;
  flex-shrink: 0;
}

/* Collapsed State */
body.sidebar-collapsed .sidebar {
  transform: translateX(-320px);
  opacity: 0;
  pointer-events: none;
}

.logo {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 40px;
  padding-left: 15px;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  white-space: nowrap;
}

.logo span {
  background: linear-gradient(135deg, #e11d48, #9f1239);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar nav {
  flex-grow: 1;
}

.sidebar nav ul {
  list-style: none;
}

.sidebar nav ul li {
  margin-bottom: 5px;
}

.sidebar nav ul li a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  transition: var(--transition);
  white-space: nowrap;
}

.sidebar nav ul li.active a,
.sidebar nav ul li a:hover {
  background: var(--accent-soft);
  color: var(--accent-color);
}

/* İçerik Alanı */
.content {
  flex: 1;
  padding: 40px;
  margin-left: calc(var(--sidebar-width) + 40px);
  /* ADJUSTED MARGIN */
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  width: 100%;
  transition: var(--transition);
}

body.sidebar-collapsed .content {
  margin-left: 0;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  position: sticky;
  top: 0;
  background: var(--bg-color);
  padding: 10px 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

#sidebar-toggle {
  background: #fff;
  border: 1px solid var(--border-color);
  width: 45px;
  height: 45px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

#sidebar-toggle:hover {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

header h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

header p {
  color: var(--text-muted);
  font-size: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 10px;
}

.card {
  background: var(--card-bg);
  padding: 28px;
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}



.card-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-soft);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  margin-bottom: 18px;
}

.card-title {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
}

/* Footer */
footer {
  margin-top: auto;
  padding: 40px 0 20px 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

footer a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

#theme-toggle {
  margin-top: 20px;
  padding: 12px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#theme-toggle:hover {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

/* Preloader */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(241, 245, 249, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
}

#preloader.loaded {
  opacity: 0;
  visibility: hidden;
}

.loader-icon {
  width: 90px;
  height: 90px;
  background: var(--accent-color);
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  animation: pulse-ring 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 15px 30px var(--accent-soft);
}

.loader-icon i {
  width: 45px;
  height: 45px;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.5);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 25px rgba(225, 29, 72, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0);
  }
}

/* Page Transitions */
.content {
  opacity: 0;
  transform: translateY(15px);
  animation: fadeInContent 1s forwards 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInContent {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Mobile Responsive */
@media (max-width: 1024px) {
  body {
    overflow-x: hidden;
  }

  /* Overlay Style */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
  }

  body:not(.sidebar-collapsed) .sidebar-overlay {
    opacity: 1;
    visibility: visible;
  }

  .sidebar {
    /* Masaüstü ayarlarını mobilde de koru, sadece biraz daha sıkıştır */
    transform: translateX(-320px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    visibility: visible !important;
    /* Görünürlüğü zorla */
    z-index: 1000;
  }

  body:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--accent-color);
  }

  .content {
    margin-left: 0 !important;
    padding: 20px;
    width: 100%;
    min-width: 100%;
  }

  .header-top {
    flex-direction: row;
    /* Başlık ve profil yan yana kalsın */
    align-items: center;
    gap: 10px;
    padding: 15px 0;
    margin-bottom: 25px;
  }

  .header-top h1 {
    font-size: 20px;
  }

  .header-top p {
    display: none;
    /* Mobilde açıklamayı gizle yer kazanılsın */
  }

  .user-profile span {
    display: none;
    /* Mobilde "Admin Panel" yazısını gizle */
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  header h1 {
    font-size: 26px;
  }
}

/* ═══════════════════════════════════════════ */
/*   E-FATURA YENİ STİLLER                   */
/* ═══════════════════════════════════════════ */

/* Tablo */
.table-wrapper {
  overflow-x: auto;
}

.fatura-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.fatura-table thead th {
  background: var(--bg-color);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.fatura-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
}

.fatura-table tbody tr:last-child td {
  border-bottom: none;
}

.fatura-table tbody tr:hover td {
  background: var(--accent-soft);
}

.row-highlight td {
  background: rgba(225, 29, 72, 0.03);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-green {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.badge-blue {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

.badge-red {
  background: rgba(225, 29, 72, 0.12);
  color: var(--accent-color);
}

.badge-yellow {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

/* Butonlar */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
}

.btn-primary:hover {
  background: #c01141;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-soft);
}

.btn-primary.loading {
  opacity: 0.7;
  pointer-events: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-secondary:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* Ayrıştır Layout */
.ayristir-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.ayristir-input-card {
  flex: 0 0 420px;
  min-width: 320px;
}

.ayristir-result-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.result-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 0;
}

.result-mini-card {
  padding: 20px !important;
}

/* Textarea */
#json-input {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-main);
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  transition: var(--transition);
  min-height: 300px;
}

#json-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-clear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.btn-clear:hover {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

/* Sonuç tablo sütunları */
.td-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.td-label svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.td-db code {
  font-size: 12px;
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
  padding: 3px 8px;
  border-radius: 6px;
}

.td-value {
  font-weight: 600;
  color: var(--text-main);
}

/* Alerts */
.alert-error {
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.25);
  border-radius: 12px;
  padding: 16px 20px;
  color: var(--accent-color);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
  padding: 16px 20px;
  color: #b45309;
  font-size: 14px;
}

.alert-success {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  padding: 16px 20px;
  color: #059669;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 14px 24px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  max-width: 380px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-success {
  background: #059669;
  color: #fff;
  box-shadow: 0 8px 25px rgba(5, 150, 105, 0.35);
}

.toast-error {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 8px 25px var(--accent-soft);
}

.toast-info {
  background: #4f46e5;
  color: #fff;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.35);
}

/* Responsive */
@media (max-width: 900px) {
  .ayristir-layout {
    flex-direction: column;
  }

  .ayristir-input-card {
    flex: unset;
    width: 100%;
  }
}