/* ============================================================================
   MakineKonfiguratör Pro — Tasarım sistemi (Tailwind CDN üstüne özel katman)
   ========================================================================== */

:root {
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-400: #60a5fa;
  --brand-500: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --brand-900: #172554;

  --bg:        #f4f6fb;
  --surface:   #ffffff;
  --surface-2: #f8fafc;
  --border:    #e7eaf0;
  --text:      #0f172a;
  --text-soft: #64748b;
  --text-mute: #94a3b8;

  --success:   #0f9d6e;
  --success-bg:#e7f7f0;
  --warning:   #c2770a;
  --warning-bg:#fdf2e0;
  --danger:    #dc2626;
  --danger-bg: #fdecec;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow:    0 4px 12px -2px rgba(15,23,42,.08), 0 2px 6px -2px rgba(15,23,42,.05);
  --shadow-lg: 0 18px 40px -12px rgba(15,23,42,.20);
  --radius:    14px;
  --sidebar-w: 248px;
}

html.dark {
  --bg:        #0b1120;
  --surface:   #131c2e;
  --surface-2: #0f1729;
  --border:    #243049;
  --text:      #e8edf6;
  --text-soft: #94a3b8;
  --text-mute: #64748b;
  --brand-50:  #16233d;
  --brand-100: #1c2c4a;
  --success-bg:#0e2a22;
  --warning-bg:#2c2008;
  --danger-bg: #2c1414;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 6px 18px -4px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 50px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- App shell */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; box-shadow: 0 6px 16px -4px var(--brand-500);
}

.nav-section { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-mute);
  padding: 14px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin-bottom: 3px;
  border-radius: 10px; font-size: 13.5px; font-weight: 500;
  color: var(--text-soft); text-decoration: none;
  position: relative; transition: all .16s;
}
.nav-link i { font-size: 18px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active {
  background: var(--brand-50); color: var(--brand-600); font-weight: 600;
}
.nav-link.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--brand-500);
}
.nav-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 700; color: #fff;
  background: var(--brand-500); border-radius: 99px; padding: 1px 7px; min-width: 18px; text-align: center;
}

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

.main {
  flex: 1; min-width: 0; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 16px; font-weight: 650; margin: 0; }

.content { padding: 22px; max-width: 1400px; width: 100%; }

/* Mobile */
.menu-btn, .backdrop { display: none; }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .backdrop.show {
    display: block; position: fixed; inset: 0; z-index: 40;
    background: rgba(15,23,42,.5); backdrop-filter: blur(2px);
  }
}

/* ----------------------------------------------------------------- Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-hover { transition: transform .18s, box-shadow .18s, border-color .18s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-200); }

.sec-title {
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 14px;
}
.page-title { font-size: 19px; font-weight: 700; margin: 0; }
.page-sub { font-size: 13px; color: var(--text-soft); margin-top: 2px; }

/* ----------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn i { font-size: 17px; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff; border-color: transparent; box-shadow: 0 4px 14px -4px var(--brand-500);
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--brand-500), var(--brand-600)); }
.btn-success { background: var(--success); color: #fff; border-color: transparent; }
.btn-danger  { background: var(--danger);  color: #fff; border-color: transparent; }
.btn-ghost   { background: transparent; border-color: transparent; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ----------------------------------------------------------------- Forms */

.form-group { margin-bottom: 14px; }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.input, .select, textarea.input {
  width: 100%; padding: 9px 12px; font-size: 13.5px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent);
}
.input::placeholder { color: var(--text-mute); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }

/* ----------------------------------------------------------------- Badges */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
}
.badge-blue  { background: var(--brand-50);   color: var(--brand-600); }
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-amber { background: var(--warning-bg); color: var(--warning); }
.badge-red   { background: var(--danger-bg);  color: var(--danger); }
.badge-gray  { background: var(--surface-2);  color: var(--text-soft); }

/* ----------------------------------------------------------------- Tables */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--text-mute);
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ----------------------------------------------------------------- Metrics */

.metric {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
}
.metric-icon {
  width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 12px;
}
.metric-label { font-size: 12px; color: var(--text-soft); font-weight: 500; }
.metric-value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; }
.metric-sub { font-size: 11.5px; color: var(--text-mute); margin-top: 3px; }

/* ----------------------------------------------------------------- Catalog cards */

.machine-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: all .18s; position: relative; display: flex; flex-direction: column;
}
.machine-card:hover { border-color: var(--brand-200); transform: translateY(-3px); box-shadow: var(--shadow); }
.machine-card.selected { border-color: var(--brand-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 16%, transparent); }
.machine-thumb {
  height: 116px; background: linear-gradient(135deg, var(--brand-50), var(--surface-2));
  display: flex; align-items: center; justify-content: center; font-size: 42px; color: var(--brand-400);
  position: relative;
}
.machine-thumb img { width: 100%; height: 100%; object-fit: cover; }
.machine-check {
  position: absolute; top: 9px; left: 9px; width: 24px; height: 24px; border-radius: 99px;
  background: var(--brand-500); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px;
  box-shadow: var(--shadow); animation: pop .2s;
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

.qty-btn {
  width: 26px; height: 26px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-soft); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; line-height: 1; transition: all .12s; user-select: none;
}
.qty-btn:hover { background: var(--brand-50); color: var(--brand-600); border-color: var(--brand-200); }

/* ----------------------------------------------------------------- Toasts */

#toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500; min-width: 240px; max-width: 360px;
  animation: toast-in .3s cubic-bezier(.2,.8,.2,1);
}
.toast.out { animation: toast-out .25s forwards; }
.toast-icon { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.toast-success .toast-icon { background: var(--success-bg); color: var(--success); }
.toast-error .toast-icon   { background: var(--danger-bg); color: var(--danger); }
.toast-info .toast-icon    { background: var(--brand-50); color: var(--brand-600); }
@keyframes toast-in  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px); } }

/* ----------------------------------------------------------------- Misc */

.divider { height: 1px; background: var(--border); margin: 14px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 500;
}
.empty {
  text-align: center; padding: 64px 20px; color: var(--text-mute);
}
.empty i { font-size: 52px; display: block; margin-bottom: 12px; opacity: .4; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.fade-in { animation: fade-in .35s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; border: 2px solid var(--surface); }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

.ti { font-size: 18px; line-height: 1; }

/* Segmented control */
.segment { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.segment button { border: none; background: transparent; padding: 6px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); cursor: pointer; transition: all .14s; }
.segment button.active { background: var(--surface); color: var(--brand-600); box-shadow: var(--shadow-sm); }

/* Switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; cursor: pointer; inset: 0; background: var(--border); border-radius: 99px; transition: .2s; }
.switch span::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + span { background: var(--brand-500); }
.switch input:checked + span::before { transform: translateX(18px); }
