/* ==========================================
   MGTAKAS - GLOBAL STYLE.CSS (CLEAN)
   - auth (login) + app (index/new_offer) UI
   ========================================== */

/* ---- Reset / Base ---- */
*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #0f172a;
}

/* ---- Theme tokens ---- */
:root{
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, .10);
  --shadow: 0 10px 25px rgba(15, 23, 42, .10);
  --primary: #16a34a;
  --primary-2: #0ea5e9;
  --danger: #ef4444;
  --warn: #f59e0b;
}

/* ==========================================
   AUTH (LOGIN) PAGES
   body sınıfı: auth-body
   ========================================== */
.auth-body{
  background: url("/assets/img/bg.png") no-repeat center center fixed;
  background-size: cover;
}

/* login wrapper kullanıyorsan */
.page-wrap{
  min-height: 100vh;
  background: rgba(255,255,255,0.85);
}

/* ==========================================
   GENERIC ELEMENTS
   ========================================== */
a{ color: inherit; }

/* Eğer legacy sidebar linkleri varsa */
.sidebar a{
  color: #1a73e8;
  text-decoration: underline;
}

/* ==========================================
   APP UI (Index + New Offer)
   body sınıfı: app-body
   ========================================== */
.app-body{
  background: var(--bg);
  color: var(--text);
}

.app-shell{
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.app-sidebar{
  width: 270px;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--line);
  padding: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px 8px 14px 8px;
}

.brand img{
  width: 100%;
  max-width: 220px;
  height: auto;
  object-fit: contain;
  display:block;
}

.userbox{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .06);
  margin-bottom: 12px;
}

.userbox-name{
  font-weight: 800;
  letter-spacing: .2px;
  margin-bottom: 6px;
}

.userbox-sub{
  display:flex;
  justify-content:space-between;
  color: var(--muted);
  font-weight: 650;
}

/* Nav */
.nav{
  display:flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link{
  text-decoration:none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all .15s ease;
  background: transparent;
  cursor: pointer;
  font-weight: 700;
  display: block;
}

.nav-link:hover{
  background: rgba(22,163,74,.08);
  border-color: rgba(22,163,74,.18);
}

.nav-link.active{
  background: rgba(22,163,74,.12);
  border-color: rgba(22,163,74,.28);
}

.nav-link.danger{ color: var(--danger); }
.nav-link.danger:hover{
  background: rgba(239,68,68,.10);
  border-color: rgba(239,68,68,.25);
}

.nav-link-btn{
  appearance: none;
  width: 100%;
  text-align: left;
}

.nav-sep{
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

.nav-sub{
  padding: 6px 0 6px 12px;
  border-left: 2px solid rgba(22,163,74,.25);
  margin-left: 6px;
}

.nav-sublink{
  display:block;
  text-decoration:none;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
}

.nav-sublink:hover{
  color: var(--text);
  background: rgba(15,23,42,.04);
}

/* Main */
.app-main{
  flex: 1;
  padding: 18px 22px;
}

/* Page head */
.page-head{
  display:flex;
  align-items:flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 14px 12px;
}

.page-title h1{
  margin: 0;
  font-size: 22px;
  letter-spacing: .2px;
}

.page-sub{
  margin-top: 6px;
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
}

.page-actions{
  display:flex;
  align-items:center;
  gap: 10px;
}

/* Buttons (tek tanım!) */
.btn{
  appearance:none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  display:inline-flex;
  align-items:center;
  gap: 8px;
}

.btn:hover{
  box-shadow: 0 8px 18px rgba(15,23,42,.10);
  transform: translateY(-1px);
}

.btn.primary{
  background: var(--primary);
  border-color: rgba(22,163,74,.45);
  color: #fff;
}

.btn.ghost{
  background: rgba(15,23,42,.03);
  border-color: rgba(15,23,42,.10);
}

.btn.small{
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 13px;
}

.icon-btn{
  border: 1px solid var(--line);
  background: #fff;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  cursor:pointer;
  font-size: 20px;
  line-height: 1;
}

/* Tabs */
.tabs{
  display:flex;
  gap: 10px;
  padding: 0 12px 14px 12px;
  flex-wrap: wrap;
}

.tab{
  text-decoration:none;
  color: var(--text);
  background: rgba(255,255,255,.85);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 12px;
  display:inline-flex;
  align-items:center;
  gap: 8px;
  font-weight: 800;
}

.tab.active{
  background: rgba(22,163,74,.12);
  border-color: rgba(22,163,74,.30);
}

.badge{
  background: rgba(15,23,42,.08);
  border: 1px solid rgba(15,23,42,.10);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

/* Alerts */
.alert{
  margin: 0 12px 12px 12px;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 750;
}

.alert.ok{
  border-color: rgba(22,163,74,.28);
  background: rgba(22,163,74,.08);
}

.alert.err{
  border-color: rgba(239,68,68,.30);
  background: rgba(239,68,68,.08);
}

.alert.warn{
  border-color: rgba(245,158,11,.35);
  background: rgba(245,158,11,.10);
}

/* Card */
.card{
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin: 0 12px 18px 12px;
}

.card-head{
  padding: 14px 16px 10px 16px;
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content: space-between;
}

.card-title{
  font-weight: 900;
  font-size: 15px;
}

.card-muted{
  color: var(--muted);
  font-weight: 650;
  margin-top: 4px;
  font-size: 13px;
}

/* Table */
.table-wrap{
  overflow:auto;
  border-radius: 18px;
}

.table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}

.table thead th{
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
}

.table tbody td{
  padding: 12px 12px;
  border-bottom: 1px solid rgba(15,23,42,.06);
  vertical-align: top;
}

.table tbody tr:hover td{
  background: rgba(15,23,42,.02);
}

.table .num{
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.drug-name{
  font-weight: 900;
  letter-spacing: .2px;
}

.meta{
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items:center;
}

.meta .dot{ opacity: .5; }
.meta .note{ color: rgba(15,23,42,.75); }

/* Qty form */
.qty-form{
  display:flex;
  gap: 8px;
  align-items:center;
  justify-content:flex-end;
  margin: 0;
}

.qty-input{
  width: 90px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  outline: none;
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: #fff;
}

.qty-input:focus{
  border-color: rgba(22,163,74,.45);
  box-shadow: 0 0 0 4px rgba(22,163,74,.12);
}

/* Progress */
.progress-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  margin-bottom: 8px;
}

.muted{
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.mono{
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: rgba(15,23,42,.8);
  font-weight: 800;
}

.progress{
  height: 10px;
  border-radius: 999px;
  background: rgba(15,23,42,.08);
  overflow:hidden;
  border: 1px solid rgba(15,23,42,.08);
}

.progress-bar{
  height: 100%;
  background: linear-gradient(90deg, rgba(22,163,74,.85), rgba(22,163,74,1));
  border-radius: 999px;
}

/* Row actions */
.row-actions{
  margin-top: 10px;
  display:flex;
  gap: 8px;
  align-items:center;
}

.empty{
  text-align:center;
  color: var(--muted);
  font-weight: 700;
  padding: 24px 12px !important;
}

/* Modal */
.no-scroll{ overflow:hidden; }

.modal{ display:none; }
.modal.open{ display:block; }

.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .55);
  backdrop-filter: blur(3px);
  z-index: 50;
}

.modal-panel{
  position: fixed;
  z-index: 51;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100vw - 24px);
  max-width: 720px;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(2, 6, 23, .35);
  overflow:hidden;
}

.modal-head{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title{
  font-weight: 900;
  font-size: 16px;
}

.modal-sub{
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.modal-body{
  padding: 16px;
  max-height: 70vh;
  overflow:auto;
}

.modal-foot{
  padding: 12px 16px 16px 16px;
  border-top: 1px solid var(--line);
  display:flex;
  justify-content:flex-end;
}

/* Who list */
.who-total{
  display:flex;
  justify-content:space-between;
  align-items:center;
  background: rgba(15,23,42,.03);
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 900;
}

.who-rows{
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 14px;
  overflow:hidden;
  background: #fff;
}

.who-row{
  display:flex;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15,23,42,.06);
}

.who-row:last-child{ border-bottom: none; }
.who-name{ font-weight: 800; }
.who-qty{ font-weight: 900; font-variant-numeric: tabular-nums; }

/* ==========================================
   FORM EXTENSIONS (New Offer)
   ========================================== */
.form-pad{ padding: 14px 16px 18px 16px; }

.form-grid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.col-12{ grid-column: 1 / -1; }
.col-6{ grid-column: span 6; }
.col-4{ grid-column: span 4; }

.lbl{
  display:block;
  font-weight: 900;
  font-size: 12px;
  color: rgba(15,23,42,.75);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}

.inp{
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
  outline: none;
  font-weight: 800;
  color: rgba(15,23,42,.92);
}

.inp:focus{
  border-color: rgba(22,163,74,.45);
  box-shadow: 0 0 0 4px rgba(22,163,74,.12);
}

.help{
  margin-top: 6px;
  color: rgba(100,116,139,.95);
  font-weight: 650;
  font-size: 13px;
}

.inline-box{
  margin-top: 10px;
  border: 1px dashed rgba(15,23,42,.18);
  border-radius: 14px;
  padding: 12px;
  background: rgba(15,23,42,.02);
}

.inline-row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}

.inline-title{ font-weight: 950; }
.inline-sub{
  color: rgba(100,116,139,.95);
  font-weight: 650;
  margin-top: 2px;
  font-size: 13px;
}

/* Dropdown */
.drop{
  margin-top: 8px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15,23,42,.12);
  max-height: 260px;
  overflow-y: auto;
}

.drop-item{
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  border-bottom: 1px solid rgba(15,23,42,.06);
}

.drop-item:last-child{ border-bottom: none; }
.drop-item:hover{ background: rgba(22,163,74,.08); }

/* Meal grid */
.meal-grid{
  margin-top: 12px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

/* Responsive */
@media (max-width: 980px){
  .app-sidebar{ width: 240px; }
  .table{ min-width: 980px; }
}

@media (max-width: 820px){
  .app-shell{ display:block; }
  .app-sidebar{
    position: relative;
    width: auto;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .app-main{ padding: 14px 12px; }
  .page-head{ padding: 10px 6px 12px 6px; }
  .tabs{ padding: 0 6px 12px 6px; }
  .card{ margin: 0 6px 14px 6px; }

  .col-6, .col-4{ grid-column: 1 / -1; }
  .meal-grid{ grid-template-columns: 1fr; }
}
.inp.is-invalid,
.qty-input.is-invalid,
select.inp.is-invalid,
textarea.inp.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,.12) !important;
}

.field-error {
  color: #dc2626;
  font-size: 12px;
  margin-top: 6px;
}
/* ==========================================
   LAYOUT OVERRIDE (TEK KAYNAK - ÇAKIŞMA YOK)
   Bu blok dosyanın EN ALTINDA kalsın.
   ========================================== */

html, body{
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

.app-shell{
  min-height: 100vh;
  display: flex;
  width: 100%;
}

/* Sidebar: sabit değil, STICKY (en sağlıklısı) */
.app-sidebar{
  width: 280px;
  flex: 0 0 280px;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: auto;
}

/* Main: flex ile kalan alanı TAM doldurur */
.app-main{
  flex: 1 1 auto;
  min-width: 0;        /* kritik */
  margin-left: 0;      /* fixed düzeninden kalan kaydırmayı iptal */
  width: auto;
  overflow-x: hidden;
  padding: 18px 22px;  /* sizde zaten vardı, burada tekleştirdik */
}

/* Üst header sticky kalsın */
.page-head{
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246,247,251,.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

/* Tablo genişse SADECE tablo içinde yatay kaydır */
.table-wrap{
  width: 100%;
  overflow-x: auto;
}

/* Tablo kolonları çoksa normal: içeride kayar */
.table{
  width: 100%;
  min-width: 980px;
}

/* Header içindeki butonlar %100’e yayılmasın */
.page-actions .btn,
.page-actions a.btn{
  width: auto !important;
  display: inline-flex !important;
}

/* Mobil */
@media (max-width: 820px){
  .app-shell{ display: block; }

  .app-sidebar{
    position: relative;
    width: 100%;
    flex: none;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .app-main{
    padding: 14px 12px;
  }
}
