/* Biltek Portal — statik site ile uyumlu tasarım dili */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sky-50: #f0f9ff;
  --sky-100: #e0f2fe;
  --sky-700: #0369a1;
  --sky-800: #075985;
  --slate-50: #f8fafc;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-900: #0f172a;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --red-600: #dc2626;
  --amber-600: #d97706;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  color: var(--slate-900);
  background: #fff;
  line-height: 1.6;
}

a { color: var(--sky-700); text-decoration: none; }
a:hover { color: var(--sky-800); }

.container { max-width: 72rem; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 4rem 0; }
.section-sm { padding: 2rem 0; }
.section-muted { background: var(--slate-50); }

.site-header {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--slate-200);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(6px);
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 0;
}
.logo img { height: 44px; width: auto; display: block; }
.nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.nav a {
  color: var(--slate-700); font-size: .875rem; font-weight: 500;
  padding: .25rem .5rem; border-radius: .375rem;
}
.nav a:hover { background: var(--slate-50); color: var(--slate-900); }

.site-footer {
  background: var(--slate-900); color: #cbd5e1; padding: 3rem 0 1.5rem; margin-top: auto;
}
.site-footer a { color: #e2e8f0; }
.site-footer .copy { border-top: 1px solid #334155; margin-top: 2rem; padding-top: 1rem; font-size: .875rem; color: #94a3b8; }

.page-wrap { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

h1 { font-size: clamp(1.875rem, 4vw, 2.25rem); font-weight: 700; letter-spacing: -.025em; margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 1.875rem); font-weight: 700; margin: 0 0 .75rem; }
h3 { font-size: 1.125rem; font-weight: 600; margin: 0 0 .5rem; }
.lead { color: var(--slate-600); max-width: 42rem; }
.eyebrow { font-size: .875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--sky-700); margin-bottom: .5rem; }

.card {
  background: #fff; border: 1px solid var(--slate-200); border-radius: .75rem;
  padding: 1.5rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); overflow: visible;
}
.card-lg { border-radius: 1rem; padding: 2rem; }
.card-accent { border-top: 4px solid var(--sky-700); }

.grid-2 { display: grid; gap: 1.5rem; }
.grid-3 { display: grid; gap: 1.5rem; }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.form-group { display: grid; gap: .375rem; margin-bottom: 1rem; }
.form-group label { font-size: .875rem; font-weight: 500; color: var(--slate-900); }
.form-control, .form-select, .form-textarea {
  width: 100%; border: 1px solid var(--slate-300); border-radius: .5rem;
  padding: .625rem .75rem; font: inherit; background: #fff;
}
.form-control:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--sky-700); box-shadow: 0 0 0 3px var(--sky-100);
}
.form-textarea { min-height: 120px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: none; border-radius: .5rem; padding: .625rem 1rem;
  font-size: .875rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--sky-700); color: #fff; }
.btn-primary:hover { background: var(--sky-800); color: #fff; }
.btn-success { background: var(--emerald-600); color: #fff; }
.btn-success:hover { background: var(--emerald-700); color: #fff; }
.btn-secondary { background: #fff; color: var(--slate-700); border: 1px solid var(--slate-300); }
.btn-secondary:hover { background: var(--slate-50); color: var(--slate-900); }
.btn-block { width: 100%; }

.alert {
  border-radius: .5rem; padding: .875rem 1rem; margin-bottom: 1rem; font-size: .875rem;
}
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: var(--sky-50); color: #0c4a6e; border: 1px solid var(--sky-100); }

.badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: .125rem .625rem; font-size: .75rem; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: var(--sky-100); color: #075985; }
.badge-muted { background: var(--slate-200); color: var(--slate-700); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--slate-200); }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-500); background: var(--slate-50); }
tr:hover td { background: #fafafa; }

.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat-card { background: #fff; border: 1px solid var(--slate-200); border-radius: .75rem; padding: 1.25rem; }
.stat-card .label { font-size: .75rem; color: var(--slate-500); text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; margin-top: .25rem; }

.breadcrumb { font-size: .875rem; color: var(--slate-500); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--slate-500); }
.breadcrumb a:hover { color: var(--sky-700); }

.cta-band {
  background: var(--sky-700); color: #fff; border-radius: 1rem; padding: 2rem;
}
.cta-band p { color: var(--sky-100); margin: .5rem 0 0; }

/* Admin layout */
.admin-layout { display: grid; min-height: 100vh; }
@media (min-width: 992px) {
  .admin-layout { grid-template-columns: 240px 1fr; }
}
.admin-sidebar {
  background: var(--slate-900); color: #e2e8f0; padding: 1.5rem 1rem;
}
.admin-sidebar .brand { font-weight: 700; color: #fff; margin-bottom: 1.5rem; display: block; }
.admin-nav { display: grid; gap: .25rem; }
.admin-nav a {
  color: #cbd5e1; padding: .625rem .75rem; border-radius: .5rem; font-size: .875rem; font-weight: 500;
}
.admin-nav a:hover, .admin-nav a.active { background: #1e293b; color: #fff; }
.admin-main { background: var(--slate-50); }
.admin-topbar {
  background: #fff; border-bottom: 1px solid var(--slate-200);
  padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center;
}
.admin-content { padding: 1.5rem; }

.device-list-item {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  padding: 1rem; border: 1px solid var(--slate-200); border-radius: .75rem; background: #fff;
}
.device-list-item + .device-list-item { margin-top: .75rem; }
.device-code { font-family: ui-monospace, monospace; font-weight: 700; color: var(--sky-800); }

.service-timeline-item {
  border-left: 3px solid var(--sky-700); padding-left: 1rem; margin-bottom: 1.25rem;
}
.service-timeline-item:last-child { margin-bottom: 0; }

.text-muted { color: var(--slate-600); }
.text-sm { font-size: .875rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.flex { display: flex; } .gap-2 { gap: .5rem; } .gap-4 { gap: 1rem; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .flex-wrap { flex-wrap: wrap; }

.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: .375rem .625rem; font-size: .8125rem; }
.text-danger { color: var(--red-600); }
.text-danger:hover { color: #b91c1c; }

.table-actions { white-space: nowrap; }
.table-actions a + a { margin-left: .75rem; }

.table-compact th, .table-compact td { padding: .5rem .625rem; }

.device-code-input {
  display: flex; align-items: stretch;
}
.device-code-fixed {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .625rem .75rem; border: 1px solid var(--slate-300); border-right: 0;
  border-radius: .5rem 0 0 .5rem; background: var(--slate-50);
  font-family: ui-monospace, monospace; font-weight: 700; color: var(--sky-800);
  white-space: nowrap;
}
.device-code-editable {
  border-radius: 0 .5rem .5rem 0 !important;
  font-family: ui-monospace, monospace; text-transform: uppercase; flex: 1;
  letter-spacing: .02em;
}

/* Sabit önek + yazı alanı — tek çerçeve (BTK-, 0 vb.) */
.prefixed-input {
  display: flex; align-items: stretch; width: 100%;
  border: 1px solid var(--slate-300); border-radius: .5rem;
  background: #fff; overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.prefixed-input:focus-within {
  border-color: var(--sky-700);
  box-shadow: 0 0 0 3px var(--sky-100);
}
.prefixed-input-fixed {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .625rem .75rem; background: var(--slate-50);
  border-right: 1px solid var(--slate-300);
  font-family: ui-monospace, monospace; font-weight: 700; color: var(--sky-800);
  flex-shrink: 0; user-select: none;
}
.prefixed-input-field {
  flex: 1; min-width: 0;
  border: none !important; border-radius: 0 !important;
  box-shadow: none !important; background: transparent;
}
.prefixed-input-field:focus {
  outline: none; box-shadow: none !important;
}
.device-code-editable.prefixed-input-field {
  text-transform: uppercase; letter-spacing: .02em;
}

/* Telefon: tek kutu, içinde sabit 0 */
.phone-input-box {
  position: relative;
}
.phone-input-box::before {
  content: '0';
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: var(--sky-800);
  pointer-events: none;
  z-index: 1;
}
.phone-input-box-field {
  padding-left: 1.75rem !important;
  font-family: ui-monospace, monospace;
  letter-spacing: .02em;
}

/* Cihaz kodu: tek kutu, içinde sabit BTK- */
.device-code-input-box {
  position: relative;
}
.device-code-input-box::before {
  content: 'BTK-';
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: var(--sky-800);
  pointer-events: none;
  z-index: 1;
}
.device-code-input-box-field {
  padding-left: 3.5rem !important;
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.device-code-field {
  display: flex; align-items: stretch; gap: .375rem; flex-wrap: wrap;
}
.device-code-prefix, .device-code-sep {
  display: inline-flex; align-items: center; font-family: ui-monospace, monospace;
  font-weight: 700; color: var(--sky-800); padding: 0 .25rem;
}
.device-code-type { max-width: 72px; flex: 0 0 72px; font-family: ui-monospace, monospace; text-transform: uppercase; text-align: center; }
.device-code-number { max-width: 140px; flex: 1 1 120px; font-family: ui-monospace, monospace; }

.autocomplete { position: relative; z-index: 1; }
.autocomplete.is-open { z-index: 20; }
.autocomplete-list {
  position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 2px);
  max-height: 240px; overflow-y: auto; margin: 0; padding: .25rem 0; list-style: none;
  background: #fff; border: 1px solid var(--slate-300);
  border-radius: .5rem; box-shadow: 0 10px 28px rgba(15,23,42,.14);
}
.autocomplete-list[hidden] { display: none !important; }
.autocomplete.is-open .autocomplete-list { display: block !important; }
.autocomplete-list li {
  padding: .55rem .75rem; cursor: pointer; font-size: .875rem;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: center;
}
.autocomplete-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.autocomplete-meta {
  color: var(--slate-500); font-size: .75rem; white-space: nowrap;
  padding: .15rem .45rem; border-radius: 999px; background: var(--slate-100);
}
.autocomplete-list li.autocomplete-add .autocomplete-meta {
  color: var(--sky-800); background: var(--sky-100); font-weight: 600;
}
.autocomplete-list li.is-active,
.autocomplete-list li:hover { background: var(--sky-50); color: var(--sky-900); }
.autocomplete-list li.autocomplete-custom { border-top: 1px solid var(--slate-200); }
.autocomplete.is-disabled { opacity: .65; }
.autocomplete.is-disabled .form-control { cursor: not-allowed; }

.combobox { position: relative; }
.combobox-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px);
  max-height: 220px; overflow-y: auto; margin: 0; padding: .25rem 0;
  list-style: none; background: #fff; border: 1px solid var(--slate-300);
  border-radius: .5rem; box-shadow: 0 8px 24px rgba(15,23,42,.12);
}
.combobox-list li {
  padding: .5rem .75rem; cursor: pointer; font-size: .875rem;
}
.combobox-list li:hover, .combobox-list li.combobox-custom {
  background: var(--sky-50);
}

.admin-only-block {
  border: 1px dashed var(--slate-300); border-radius: .75rem; padding: 1rem 1.25rem;
  background: #fafafa;
}

.cost-mode-options {
  border: 0; margin: 0; padding: 0;
}
.cost-mode-options legend {
  padding: 0;
}
.cost-mode-options label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .875rem; cursor: pointer; margin-bottom: .35rem;
}

.profit-summary {
  display: flex; flex-wrap: wrap; gap: 1rem 1.5rem;
  padding: .75rem 1rem; background: var(--slate-50); border-radius: .5rem;
}

@media (max-width: 767px) {
  .nav { display: none; }
  .admin-sidebar { padding-bottom: .5rem; }
}
