/* ═══════════════════════════════════════════════════════════
   MAKEDON İNŞAAT — Sözleşme Oluşturucu Stilleri
   ═══════════════════════════════════════════════════════════ */

.contract-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 20px; padding: 15px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md, 10px);
}
.contract-toolbar select { min-width: 220px; }
.contract-toolbar .spacer { flex: 1; }

/* ---------- KAYITLI SÖZLEŞMELER LİSTESİ ---------- */
.contract-list-panel {
  margin: 0 0 20px; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
  background: rgba(255,255,255,0.03); overflow: hidden;
}
.cl-head, .cl-row {
  display: grid; grid-template-columns: 1fr 180px 140px; gap: 12px;
  align-items: center; padding: 10px 16px;
}
.cl-head {
  background: rgba(200,164,92,0.08); font-size: 0.75rem; font-weight: 700;
  letter-spacing: 1px; color: var(--gold-primary, #C8A45C); text-transform: uppercase;
}
.cl-row { border-top: 1px solid rgba(255,255,255,0.06); font-size: 0.9rem; color: #ddd; }
.cl-row:hover { background: rgba(255,255,255,0.03); }
.cl-row.active { background: rgba(200,164,92,0.1); border-left: 3px solid var(--gold-primary, #C8A45C); }
.cl-title { font-weight: 600; }
.cl-date { color: #888; font-size: 0.82rem; }
.cl-actions { display: flex; gap: 8px; justify-content: flex-end; }
.cl-open, .cl-del {
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; font-weight: 600;
  border: 1px solid rgba(200,164,92,0.4); background: rgba(200,164,92,0.12); color: var(--gold-primary, #C8A45C);
}
.cl-open:hover { background: rgba(200,164,92,0.25); }
.cl-del { border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.12); color: #f87171; }
.cl-del:hover { background: rgba(239,68,68,0.28); }
.cl-empty { padding: 18px 16px; color: #888; font-size: 0.9rem; }

.contract-status {
  margin: -8px 0 16px; font-size: 0.85rem; color: var(--text-light, #aaa);
}
.contract-status strong { color: var(--gold-primary, #C8A45C); }

/* ---------- FORM okunabilirlik ---------- */
.cf-sec-h {
  border-left: 3px solid transparent;
}
.cf-sec-h.open { border-left-color: var(--gold-primary, #C8A45C); background: rgba(200,164,92,0.1); }
.cf-field label { color: #c5c5c5; font-weight: 500; }
.cf-in {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.16);
}
.cf-in::placeholder { color: #6a6a6a; }
.contract-toolbar .btn, .cf-add, .cl-open, .cl-del { font-weight: 600; }

.contract-layout {
  display: grid; grid-template-columns: 420px 1fr; gap: 24px; align-items: start;
}
@media (max-width: 1100px) { .contract-layout { grid-template-columns: 1fr; } }

/* ---------- FORM ---------- */
.cf-sec { border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.cf-sec-h {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; background: rgba(255,255,255,0.04); border: none;
  color: #fff; font-weight: 600; font-size: 0.95rem; cursor: pointer; text-align: left;
}
.cf-sec-h:hover { background: rgba(200,164,92,0.08); }
.cf-arrow { transition: transform .2s; color: var(--gold-primary, #C8A45C); }
.cf-sec-h.open .cf-arrow { transform: rotate(180deg); }
.cf-sec-b { display: none; padding: 14px; }
.cf-sec-b.open { display: block; }

.cf-field { margin-bottom: 10px; }
.cf-field label { display: block; font-size: 0.78rem; color: var(--text-light, #aaa); margin-bottom: 4px; }
.cf-in {
  width: 100%; padding: 9px 10px; font-size: 0.9rem;
  background: rgba(255,255,255,0.05); color: #fff;
  border: 1px solid rgba(255,255,255,0.12); border-radius: 6px;
}
.cf-in:focus { border-color: var(--gold-primary, #C8A45C); outline: none; }
.cf-in option { color: #000; }
.cf-mini { padding: 6px 8px; }
.cf-xs { max-width: 70px; }
.cf-sm { max-width: 110px; }

.cf-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.cf-row .cf-in { flex: 1; }
.cf-row .cf-xs, .cf-row .cf-sm { flex: 0 0 auto; }
.cf-blok { flex-wrap: wrap; }
.cf-row-legend { font-size: 0.68rem; color: #777; margin: -2px 0 8px; }
.cf-del {
  background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px; padding: 8px 10px; cursor: pointer; flex-shrink: 0;
}
.cf-del:hover { background: rgba(239,68,68,0.3); }
.cf-add {
  width: 100%; padding: 9px; margin-top: 4px; background: rgba(200,164,92,0.12);
  border: 1px dashed rgba(200,164,92,0.4); color: var(--gold-primary, #C8A45C);
  border-radius: 6px; cursor: pointer; font-weight: 600;
}
.cf-add:hover { background: rgba(200,164,92,0.22); }
.cf-check { display: flex; gap: 8px; align-items: center; color: var(--text-light, #aaa); font-size: 0.85rem; margin-top: 8px; }

/* ---------- BELGE ÖNİZLEME (sayfalı A4) ---------- */
.contract-doc-wrap { background: #3a3d42; padding: 28px 16px; border-radius: 10px; }
#contractDoc { font-family: 'Times New Roman', Times, serif; font-size: 10.5pt; line-height: 1.5; }

.doc-page {
  position: relative; background: #fdfcf9; color: #111;
  width: 794px; min-height: 1123px; margin: 0 auto 28px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.5);
}
/* çift altın çerçeve + köşe süsleri */
.doc-frame {
  position: absolute; inset: 10px; pointer-events: none; z-index: 2;
  border: 2px solid #C8A45C;
}
.doc-frame::before {
  content: ''; position: absolute; inset: 5px;
  border: 1px solid rgba(198,164,92,0.5);
}
.doc-frame::after {
  content: ''; position: absolute; inset: -2px;
  background:
    linear-gradient(135deg, #C8A45C 0 14px, transparent 14px) top left,
    linear-gradient(-135deg, #C8A45C 0 14px, transparent 14px) top right,
    linear-gradient(45deg, #C8A45C 0 14px, transparent 14px) bottom left,
    linear-gradient(-45deg, #C8A45C 0 14px, transparent 14px) bottom right;
  background-repeat: no-repeat; opacity: .55;
}
.doc-watermark {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url('../assets/images/makedoninsaat.png') center 42% no-repeat;
  background-size: 340px; opacity: 0.045;
}
.doc-topbar, .doc-bottombar {
  position: absolute; left: 0; right: 0; height: 6px; z-index: 3;
  background: linear-gradient(90deg, #A68841, #C8A45C, #E6CF96, #C8A45C, #A68841);
}
.doc-topbar { top: 0; } .doc-bottombar { bottom: 0; }

.doc-head-first { text-align: center; padding: 34px 0 6px; position: relative; z-index: 1; }
.doc-head-first img { height: 118px; }
.doc-head-brand { font-family: 'Outfit', sans-serif; font-weight: 800; letter-spacing: 5px; color: #A68841; font-size: 15pt; margin-top: 4px; }
.doc-head-sub { font-size: 8.5pt; color: #8a7b52; letter-spacing: 2px; }
.doc-head {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 12px;
  padding: 24px 70px 8px; border-bottom: 1px solid #d9c893; margin: 0 30px;
}
.doc-head img { height: 34px; }
.doc-head span { font-size: 7.8pt; letter-spacing: 1px; color: #8a7b52; font-weight: bold; }

.doc-body { position: relative; z-index: 1; padding: 18px 62px 60px; }
.doc-foot {
  position: absolute; bottom: 12px; left: 62px; right: 62px; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid #d9c893; padding-top: 6px;
  font-size: 7.5pt; color: #8a7b52; letter-spacing: .5px;
}
.doc-pageno { font-weight: bold; color: #A68841; }

/* başlık kutusu */
.doc-titlebox {
  border: 2px solid #C8A45C; outline: 1px solid rgba(198,164,92,.4); outline-offset: 3px;
  background: linear-gradient(180deg, #fffdf7, #faf6ea);
  padding: 16px 18px; margin: 8px 0 20px;
}
.doc-title {
  font-size: 11.5pt; font-weight: bold; text-align: center;
  margin: 0; line-height: 1.55; text-transform: uppercase; color: #1a1a1a;
}

/* madde başlığı: altın numara rozeti */
.doc-madde {
  display: flex; align-items: baseline; gap: 10px;
  margin: 20px 0 8px; padding-bottom: 5px;
  border-bottom: 1.5px solid #C8A45C; page-break-after: avoid;
}
.madde-badge {
  flex-shrink: 0; min-width: 34px; text-align: center;
  background: linear-gradient(135deg, #A68841, #C8A45C); color: #fff;
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 10pt;
  padding: 2px 8px; border-radius: 3px;
}
.madde-badge::before { content: 'MADDE'; display: block; font-size: 5.5pt; font-weight: 600; letter-spacing: 1px; }
.madde-text { font-size: 10.5pt; font-weight: bold; color: #1a1a1a; }
.doc-madde-plain { font-size: 10.5pt; font-weight: bold; }

/* önizlemede elle düzenleme */
.doc-page [contenteditable="true"] { cursor: text; outline: none; }
.doc-page [contenteditable="true"]:hover { box-shadow: 0 0 0 1px rgba(198,164,92,0.35); border-radius: 2px; }
.doc-page [contenteditable="true"]:focus { box-shadow: 0 0 0 2px rgba(198,164,92,0.6); background: rgba(198,164,92,0.06); border-radius: 2px; }

.doc-p { text-align: justify; margin: 0 0 8px; color: #222; }
.doc-pi { text-align: justify; margin: 0 0 6px 28px; color: #222; }
.doc-b { font-weight: bold; margin: 10px 0 6px; }
.doc-missing {
  background: #fff3cd; color: #8a6d00; font-weight: bold;
  padding: 0 3px; border-radius: 3px; border: 1px dashed #e0a800;
}
.doc-table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 9pt; }
.doc-table th, .doc-table td { border: 1px solid #6b6b6b; padding: 5px 7px; }
.doc-table th { background: #efe7d2; color: #4a3d1e; font-weight: bold; }
.doc-table td.c { text-align: center; }
.doc-table-section td { background: #f7f1e1; font-weight: bold; text-align: center; color: #4a3d1e; }

/* EK-A şema */
.doc-sema-wrap { margin: 8px 0 16px; }
.doc-sema { border: 2px solid #A68841; border-radius: 6px; overflow: hidden; margin-bottom: 14px; page-break-inside: avoid; }
.doc-sema-title { background: #0A0F1C; color: #C8A45C; font-weight: bold; text-align: center; padding: 7px; font-size: 10pt; letter-spacing: 1px; }
.doc-sema-row { display: flex; border-bottom: 1px solid #ccc; }
.doc-sema-row:last-child { border-bottom: none; }
.doc-sema-kat {
  width: 95px; min-width: 95px; border-right: 2px solid #A68841; display: flex; align-items: center;
  justify-content: center; font-weight: bold; background: #f7f2e5; padding: 8px 6px;
  text-align: center; font-size: 8.5pt;
}
.doc-sema-cells { display: flex; flex: 1; }
.doc-sema-cell {
  flex: 1; border-right: 1px solid #ddd; padding: 7px 5px; text-align: center;
  display: flex; flex-direction: column; justify-content: center; font-size: 8pt;
}
.doc-sema-cell:last-child { border-right: none; }
.doc-sema-cell.mut { background: #ffe066; }
.doc-sema-cell.arsa { background: #a3e6a3; }
.sc-konum { font-weight: 700; }
.sc-m2 { font-weight: 600; color: #333; }
.sc-sahip { font-size: 7.5pt; text-transform: uppercase; color: #555; }

/* imza */
.doc-sig { width: 100%; border-collapse: collapse; margin-top: 24px; font-size: 10pt; page-break-inside: avoid; }
.doc-sig td { border: 1px solid #6b6b6b; padding: 12px; vertical-align: top; }
.sig-h { background: #efe7d2; color: #4a3d1e; font-weight: bold; text-align: center; }
.sig-c { width: 50%; min-height: 110px; }
.sig-name { font-weight: bold; }
.sig-line { margin-bottom: 14px; }

/* PDF export — görünür overlay + kesintisiz kopya */
.doc-export-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(10,15,28,0.92); overflow-y: auto; padding: 30px 0;
}
.doc-export-loading {
  text-align: center; color: var(--gold-primary, #C8A45C); font-weight: 600;
  font-size: 1rem; padding: 14px; font-family: 'Outfit', sans-serif; letter-spacing: 1px;
}
.doc-export {
  width: 794px; margin: 0 auto;
  background: #fff; color: #111; padding: 30px 55px;
  font-family: 'Times New Roman', Times, serif; font-size: 10.5pt; line-height: 1.5;
}
.doc-exp-head img { display: block; height: 90px; margin: 0 auto 10px; }

@media print {
  body * { visibility: hidden; }
  #contractDoc, #contractDoc * { visibility: visible; }
  #contractDoc { position: absolute; inset: 0; width: auto; }
  .doc-page { margin: 0; box-shadow: none; page-break-after: always; }
}
