/* ===== TEMA RENKLERI ===== */
:root {
  --brand: #6c5ce7;
  --brand-dark: #5849d4;
  --brand-soft: #f1efff;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e74c3c;
  --slot-h: 32px;            /* her 30 dakikalık slot yüksekliği */
  --time-col-w: 56px;
  --staff-col-w: 180px;
}

* { box-sizing: border-box; }

body {
  background: #f5f6fa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #2d3436;
}

/* ===== NAVBAR ===== */
.app-navbar {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.app-navbar .navbar-brand { color: #fff; font-size: 1.05rem; }
.app-navbar .nav-link { color: rgba(255,255,255,.85); font-size: .92rem; padding: .5rem .85rem; }
.app-navbar .nav-link:hover, .app-navbar .nav-link.active { color: #fff; background: rgba(255,255,255,.12); border-radius: 6px; }

.blink-soft { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 0%,100% { opacity: 1 } 50% { opacity: .5 } }

/* ===== KART / GENEL ===== */
.card {
  border: none;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.card-header { background: #fff; border-bottom: 1px solid #eee; font-weight: 600; }

.btn-brand { background: var(--brand); color: #fff; border: none; }
.btn-brand:hover { background: var(--brand-dark); color: #fff; }

.table > :not(caption) > * > * { padding: .55rem .6rem; }

/* ===== LOGIN ===== */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-card {
  background: #fff; border-radius: 18px;
  width: 100%; max-width: 380px;
  padding: 28px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.login-card h1 { font-size: 1.3rem; margin-bottom: 4px; color: var(--brand); }
.login-card .subtitle { color: #999; margin-bottom: 22px; font-size: .9rem; }

/* ===== TAKVIM TOOLBAR ===== */
.calendar-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: #fff; padding: 10px 12px; border-radius: 10px;
  margin-bottom: 12px; box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.calendar-toolbar .date-display { font-weight: 600; font-size: 1rem; color: #2d3436; }
.view-selector .btn { padding: 4px 10px; font-size: .85rem; }

/* ===== LAYOUT: TAKVIM + SAĞ PANEL ===== */
.calendar-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 12px;
}
@media (max-width: 991px) {
  .calendar-layout { grid-template-columns: 1fr; }
  .side-panel { order: -1; }
}

/* Sağ panel */
.side-panel .card { margin-bottom: 12px; }
.side-panel .card-header { font-size: .92rem; padding: .55rem .75rem; }
.side-panel .card-body { padding: .65rem .75rem; }
.note-item {
  background: #fffbe6;
  border-left: 3px solid #fdcb6e;
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
  font-size: .85rem;
  position: relative;
}
.note-item .del-btn {
  position: absolute; top: 2px; right: 4px;
  cursor: pointer; color: #888; font-size: .9rem;
}
.note-item .del-btn:hover { color: #e74c3c; }

.birthday-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #eee;
  font-size: .85rem;
}
.birthday-item:last-child { border-bottom: none; }
.birthday-item .when { font-size: .7rem; color: #888; }

/* ===== TAKVIM GRID ===== */
.cal-wrap {
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.cal-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}
.cal-grid {
  display: grid;
  grid-template-columns: var(--time-col-w) repeat(var(--staff-count, 4), var(--staff-col-w));
  min-width: 100%;
  position: relative;
}
.cal-head { display: contents; }
.cal-head > div {
  background: #f8f9fc;
  border-bottom: 2px solid var(--brand);
  padding: 8px 6px;
  text-align: center;
  font-weight: 600;
  position: sticky; top: 0; z-index: 5;
  font-size: .85rem;
}
.cal-head .staff-name {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border-left: 1px solid #eee;
}
.cal-head .staff-name .color-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}

.cal-time-cell {
  background: #f8f9fc;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #f0f0f0;
  font-size: .72rem; color: #888;
  padding: 2px 4px;
  text-align: center;
  height: var(--slot-h);
  display: flex; align-items: flex-start; justify-content: center;
  position: sticky; left: 0; z-index: 3;
}
.cal-time-cell.hour-start { font-weight: 700; color: #555; background: #eef0f5; }

.cal-slot {
  border-right: 1px solid #f0f0f0;
  border-bottom: 1px solid #f5f5f5;
  height: var(--slot-h);
  position: relative;
  cursor: pointer;
}
.cal-slot.hour-start { border-bottom-color: #e3e3e3; }
.cal-slot:hover { background: var(--brand-soft); }
.cal-slot.has-conflict-warning { background: #ffe5e5 !important; }

/* ===== RANDEVU KARTI (yeni) ===== */
.cal-appt {
  position: absolute;
  left: 3px; right: 3px;
  background: #6c5ce7;
  color: #fff;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: .72rem;
  line-height: 1.25;
  overflow: hidden;
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
  user-select: none;
  z-index: 2;
  display: flex;
  flex-direction: column;
}
.cal-appt:active { cursor: grabbing; }
.cal-appt .a-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  font-weight: 700;
  font-size: .8rem;
  gap: 4px;
}
.cal-appt .a-icons { display: flex; gap: 3px; font-size: .8rem; }
.cal-appt .a-time { opacity: .9; font-size: .68rem; margin-top: 1px; }
.cal-appt .a-service { font-size: .68rem; opacity: .95; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-appt .a-bottom {
  margin-top: auto;
  padding-top: 3px;
  font-size: .68rem;
  display: flex; justify-content: space-between; align-items: center;
}
.cal-appt .remaining-badge {
  background: rgba(255,255,255,.25);
  padding: 1px 6px; border-radius: 8px;
  font-weight: 600;
}
.cal-appt .remaining-badge.low {
  background: #fff;
  color: #c0392b;
  animation: pulseRed 1.5s ease-in-out infinite;
}
@keyframes pulseRed {
  0%,100% { box-shadow: 0 0 0 0 rgba(231,76,60,.5); }
  50%     { box-shadow: 0 0 0 4px rgba(231,76,60,0); }
}
.cal-appt.status-completed { background: #00b894; }
.cal-appt.status-cancelled { background: #b2bec3; text-decoration: line-through; }
.cal-appt.status-noshow    { background: #e74c3c; }

.cal-appt.dragging { opacity: .5; }
.cal-slot.drop-target { background: #d8f5ec !important; }

/* Borç / not / kalan az ikonları */
.appt-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 10px; line-height: 1;
}
.icon-debt { background: #ff7675; color: #fff; }
.icon-note { background: #ffeaa7; color: #d35400; }
.icon-low  { background: #fff; color: #c0392b; font-weight: 700; }

.note-icon {
  display: inline-block; background: #ffeaa7; color: #d35400;
  border-radius: 50%; width: 16px; height: 16px;
  text-align: center; line-height: 16px; font-size: 10px;
  margin-left: 2px;
}

/* ===== HAFTA GÖRÜNÜMÜ ===== */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: 6px;
}
@media (max-width: 768px) {
  .week-grid { grid-template-columns: repeat(7, 90px); overflow-x: auto; }
}
.week-day {
  background: #fff; border-radius: 8px; padding: 8px;
  min-height: 200px;
}
.week-day-header {
  font-weight: 700; padding-bottom: 6px;
  border-bottom: 2px solid var(--brand);
  margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.week-day-header.today { color: var(--brand); }
.week-day-header .count { font-size: .7rem; background: var(--brand); color: #fff; padding: 1px 6px; border-radius: 8px; }
.week-appt {
  background: #f1efff;
  border-left: 3px solid var(--brand);
  padding: 4px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: .72rem;
  cursor: pointer;
}
.week-appt.status-completed { background: #d4f5e9; border-left-color: #00b894; }
.week-appt.status-cancelled { background: #ecedef; border-left-color: #b2bec3; text-decoration: line-through; }
.week-appt.status-noshow    { background: #ffe5e5; border-left-color: #e74c3c; }

/* ===== AY GÖRÜNÜMÜ ===== */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: #fff; border-radius: 10px; padding: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.month-day-name {
  text-align: center; font-weight: 700; padding: 6px 0;
  background: #f8f9fc; border-radius: 4px;
  font-size: .78rem;
}
.month-day {
  background: #fafbfc;
  min-height: 90px;
  padding: 4px;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
}
.month-day.other-month { opacity: .35; }
.month-day:hover { background: var(--brand-soft); }
.month-day.today { background: #fff8e1; }
.month-day .day-num { font-weight: 700; font-size: .85rem; }
.month-day .count-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--brand); color: #fff;
  font-size: .65rem; padding: 1px 5px; border-radius: 8px;
}
.month-day-appt {
  font-size: .65rem;
  background: var(--brand-soft);
  color: var(--brand-dark);
  padding: 1px 4px;
  border-radius: 3px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 768px) {
  .month-day { min-height: 60px; }
  .month-day-appt { display: none; }
  .month-day-name { font-size: .7rem; }
}

/* ===== MOBIL ===== */
@media (max-width: 768px) {
  :root {
    --slot-h: 50px;
    --time-col-w: 44px;
    --staff-col-w: 125px;
  }
  .app-navbar .navbar-brand { font-size: .9rem; }
  .container-fluid { padding-left: 8px; padding-right: 8px; }
  .calendar-toolbar { padding: 8px; gap: 5px; }
  .calendar-toolbar .date-display { font-size: .85rem; width: 100%; order: 99; text-align: center; }
  .calendar-toolbar .btn { padding: 4px 8px; font-size: .8rem; }
  .btn { font-size: .85rem; }
  h1, .h1 { font-size: 1.25rem; }
  h2, .h2 { font-size: 1.1rem; }
  h3, .h3 { font-size: 1rem; }
  .table { font-size: .82rem; }

  .cal-appt {
    font-size: .68rem;
    padding: 3px 5px;
  }
  .cal-appt .a-top { font-size: .72rem; }
  .cal-appt .a-time, .cal-appt .a-service, .cal-appt .a-bottom { font-size: .62rem; }
  /* Sağ panel mobilde sayfanın üstüne taşınır */
  .side-panel { margin-bottom: 12px; }
}

/* ===== MUSTERI DETAY KARTLAR ===== */
.info-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-soft); color: var(--brand-dark);
  padding: 4px 10px; border-radius: 20px; font-size: .82rem;
  margin-right: 6px; margin-bottom: 6px;
}
.info-pill.warn { background: #fff5e6; color: #d35400; }
.info-pill.danger { background: #ffe5e5; color: #c0392b; }
.info-pill.success { background: #d8f5ec; color: #00744a; }

.package-card {
  border-left: 4px solid var(--brand);
  padding: 12px;
  background: #fafbff;
  border-radius: 8px;
  margin-bottom: 10px;
}
.package-card.exhausted { border-left-color: #b2bec3; opacity: .65; }

/* ===== UTIL ===== */
.text-money { font-weight: 700; color: #00744a; }
.cursor-pointer { cursor: pointer; }
.small-muted { font-size: .8rem; color: #888; }

/* Modal mobil iyileştirme */
@media (max-width: 576px) {
  .modal-dialog { margin: 0; max-width: 100%; }
  .modal-content { border-radius: 0; min-height: 100vh; }
}
