body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

input[type="number"],
input[type="text"],
input[type="date"],
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  padding: 0.75rem;
  border-radius: 0.75rem;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.dark input[type="number"],
.dark input[type="text"],
.dark input[type="date"],
.dark select,
.dark textarea {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: #64748b !important;
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  border-color: #4f46e5;
}

.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  padding: 1.5rem;
  border-radius: 1.5rem;
  border: 1px solid #e2e8f0;
  margin-bottom: 2rem;
  position: sticky;
  top: 1rem;
  z-index: 50;
}

.dark .site-header {
  background: rgba(30, 41, 59, 0.8);
  border-color: #334155;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-circle {
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.brand-logo {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
  flex-shrink: 0;
}

/* Tailwind dark sınıfıyla birlikte görünürlük kontrolü için yardımcı sınıflar
   (Tailwind yüklü olduğu için inline/dark:hidden vs. çalışır, ekstra gerek yok) */

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dark .brand h1 {
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand p {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

.dark .brand p {
  color: #94a3b8;
}

.nav {
  display: flex;
  gap: 0.5rem;
  background: #f1f5f9;
  padding: 0.375rem;
  border-radius: 0.75rem;
  flex-wrap: wrap;
}

.dark .nav {
  background: rgba(71, 85, 105, 0.5);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

.nav-link.active {
  background: white;
  color: #4f46e5;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.dark .nav-link {
  color: #94a3b8;
}

.dark .nav-link.active {
  background: #334155;
  color: #a78bfa;
}

.theme-toggle {
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 50%;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.theme-toggle:hover {
  background: #f1f5f9;
  color: #4f46e5;
  border-color: #4f46e5;
}

.dark .theme-toggle {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.dark .theme-toggle:hover {
  background: #334155;
  border-color: #a78bfa;
  color: #a78bfa;
}

.site-main {
  display: grid !important;
  grid-template-columns: 2fr 1fr !important;
  gap: 2rem !important;
  margin-bottom: 2rem !important;
}

.tools-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 1.5rem;
  padding: 2rem;
  transition: all 0.2s ease;
}

.dark .card {
  background: #1e293b;
  border-color: #334155;
}

.card.tool {
  display: none;
  animation: slideIn 0.3s ease-out;
}

.card.tool.active {
  display: block;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.dark .tool-header {
  border-color: #334155;
}

.tool-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #0f172a;
}

.dark .tool-header h2 {
  color: white;
}

.tool-header p {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: #64748b;
}

.dark .tool-header p {
  color: #94a3b8;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
}

.dark .field label {
  color: #cbd5e1;
}

.input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.input-group .field select {
  font-size: 1rem;
  padding: 0.75rem;
}

.input-group.three-col {
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.input-group.three-col .field select {
  font-size: 0.938rem;
  padding: 0.688rem;
}

#unitCategory,
#kdvType {
  font-size: 1rem;
  padding: 0.75rem;
}

.input-group.full {
  grid-template-columns: 1fr;
}

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  cursor: pointer;
  background: white;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
}

.checkbox-group label:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.dark .checkbox-group label {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

.dark .checkbox-group label:hover {
  background: #1e293b;
  border-color: #475569;
}

.checkbox-group input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: #4f46e5;
}

.primary-btn {
  width: 100%;
  padding: 1rem;
  border-radius: 0.875rem;
  border: none;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.primary-btn:active {
  transform: translateY(0);
}

.secondary-btn {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: white;
  color: #64748b;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.dark .secondary-btn {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

.dark .secondary-btn:hover {
  background: #1e293b;
  border-color: #475569;
  color: #cbd5e1;
}

.icon-btn {
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #f1f5f9;
  color: #4f46e5;
}

.dark .icon-btn:hover {
  background: #1e293b;
  color: #a78bfa;
}

.swap-btn {
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #4f46e5;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  width: 2.5rem;
  height: 2.5rem;
  align-self: center;
  margin-top: 1.5rem;
}

.swap-btn:hover {
  background: #e0e7ff;
  border-color: #4f46e5;
  transform: rotate(180deg);
}

.dark .swap-btn {
  background: #1e293b;
  border-color: #334155;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.btn-row.two-col {
  grid-template-columns: 1fr 1fr;
  display: grid;
}

.btn-row.four-col {
  grid-template-columns: repeat(4, 1fr);
  display: grid;
  margin-top: 2rem;
}

.result-box {
  padding: 1.5rem;
  border-radius: 1rem;
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  color: #312e81;
  font-weight: 600;
  font-size: 1.125rem;
  text-align: center;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dark .result-box {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

.result-box div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

textarea {
  resize: vertical;
  min-height: 150px;
  font-family: 'Monaco', 'Menlo', monospace;
}

.text-stats {
  padding: 1rem 0;
  border-top: 1px solid #e2e8f0;
  margin-top: 1rem;
  font-size: 0.875rem;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.dark .text-stats {
  border-color: #334155;
  color: #94a3b8;
}

.password-output {
  position: relative;
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.password-output input {
  flex: 1;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: white;
  color: #0f172a;
}

.dark .password-output input {
  background: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

.info-card {
  border-radius: 1.5rem;
  padding: 2rem;
  border: none;
}

.info-card h3 {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card p {
  margin: 0.75rem 0;
  line-height: 1.6;
  font-size: 0.938rem;
}

.info-card ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
  list-style: none;
}

.info-card li {
  margin: 0.5rem 0;
  font-size: 0.938rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-card .note {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid;
  font-size: 0.75rem;
  opacity: 0.9;
}

.gradient-indigo {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
}

.gradient-amber {
  background: #fef3c7;
  color: #78350f;
}

.dark .gradient-amber {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

.dark .gradient-amber h3 {
  color: white;
}

.bottom-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.bottom-card {
  border-radius: 1.5rem;
  border: 1px solid #e2e8f0;
  background: white;
  padding: 1.5rem;
}

.dark .bottom-card {
  background: #1e293b;
  border-color: #334155;
}

.bottom-card.favorites {
  background: linear-gradient(135deg, #fef3c7, #fef08a);
  border-color: #fcd34d;
}

.dark .bottom-card.favorites {
  background: #1e293b;
  border-color: #334155;
}

.bottom-card.history {
  background: linear-gradient(135deg, #cffafe, #a5f3fc);
  border-color: #67e8f9;
}

.dark .bottom-card.history {
  background: #1e293b;
  border-color: #334155;
}

.bottom-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid;
}

.bottom-card.favorites .bottom-header {
  border-color: #fcd34d;
}

.bottom-card.history .bottom-header {
  border-color: #67e8f9;
}

.dark .bottom-header {
  border-color: #334155;
}

.bottom-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bottom-card.favorites h3 {
  color: #b45309;
}

.bottom-card.history h3 {
  color: #0c4a6e;
}

.dark .bottom-header h3 {
  color: white;
}

.btn-clear {
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  border: none;
  background: transparent;
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear:hover {
  background: rgba(220, 38, 38, 0.1);
}

.bottom-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  font-style: italic;
  font-size: 0.875rem;
}

.bottom-card.favorites .empty-state {
  color: #b45309;
}

.bottom-card.history .empty-state {
  color: #0c4a6e;
}

.dark .empty-state {
  color: #94a3b8;
}

.favorite-item,
.history-item {
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.favorite-item:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateX(4px);
}

.dark .favorite-item,
.dark .history-item {
  background: rgba(51, 65, 85, 0.5);
  border-color: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.dark .favorite-item:hover {
  background: rgba(71, 85, 105, 0.7);
}

.site-footer {
  text-align: center;
  padding: 1rem 1.5rem;
  background: #f0f4f8;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  font-size: 0.875rem;
  color: #64748b;
}

.dark .site-footer {
  background: rgba(30, 41, 59, 0.5);
  border-color: #334155;
  color: #94a3b8;
}

.site-footer p {
  margin: 0;
}

.site-footer strong {
  color: #4f46e5;
  font-weight: 600;
}

@media (min-width: 1025px) {
  .site-main {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    gap: 2rem !important;
  }
}

@media (max-width: 1024px) {
  .site-main {
    grid-template-columns: 1fr !important;
  }

  .side-column {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .side-column .card {
    flex: 1 1 calc(50% - 0.75rem);
    min-width: 250px;
  }
}

@media (max-width: 768px) {
  .site-header {
    grid-template-columns: 1fr;
    gap: 1rem;
    position: relative;
    top: 0;
  }

  .site-header .theme-toggle {
    justify-self: end;
  }

  .nav {
    order: 3;
    grid-column: 1 / -1;
    width: 100%;
  }

  .input-group {
    grid-template-columns: 1fr;
  }

  .input-group.three-col {
    grid-template-columns: 1fr;
  }

  .input-group.three-col .swap-btn {
    width: 100%;
  }

  .checkbox-group {
    grid-template-columns: 1fr;
  }

  .btn-row.four-col {
    grid-template-columns: repeat(2, 1fr);
  }

  .bottom-section {
    grid-template-columns: 1fr;
  }

  .side-column {
    flex-direction: column;
  }

  .side-column .card {
    flex: 1 1 auto;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 1rem;
  }

  .site-header {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 1rem;
  }

  .card {
    padding: 1.5rem;
    border-radius: 1rem;
  }

  .tool-header h2 {
    font-size: 1.25rem;
  }

  .btn-row.two-col {
    grid-template-columns: 1fr;
  }

  .btn-row.four-col {
    grid-template-columns: 1fr 1fr;
  }

  .bottom-content {
    max-height: 150px;
  }

  .field label {
    font-size: 0.8rem;
  }

  input[type="number"],
  input[type="text"],
  select,
  textarea {
    font-size: 16px;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.hint {
  margin-top: 1rem;
  padding: 1rem;
  background: #f0f4f8;
  border-left: 3px solid #4f46e5;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: #475569;
}

.dark .hint {
  background: rgba(79, 70, 229, 0.1);
  color: #cbd5e1;
}

.hint i {
  margin-right: 0.5rem;
  color: #4f46e5;
}

.primary-btn:focus,
.secondary-btn:focus,
.nav-link:focus,
.theme-toggle:focus {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

@media (prefers-contrast: more) {
  .primary-btn {
    border: 2px solid #2d1b69;
  }

  .secondary-btn {
    border: 2px solid #475569;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
