/* FreeHand MX 11 Entegrasyon Stilleri (Oda.html Uyumlu) */
:root {
  --fh-win-bg: #ece9d8;
  --fh-win-border: #002d96;
  --fh-win-title-start: #0055ea;
  --fh-win-title-end: #3b88ff;
  --fh-win-text: #000000;
  --fh-panel-bg: #f0eee6;
  --fh-panel-border: #7f9db9;
  --fh-tab-active: #ffffff;
  --fh-tab-inactive: #d4d0c8;
}

/* Şeffaf Vektör Anotasyon Katmanı */
#fh-canvas-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 80;
  pointer-events: none;
}

#fh-canvas-overlay.pen-active {
  pointer-events: auto;
  cursor: crosshair;
}

#fh-canvas-overlay.eraser-active {
  pointer-events: auto;
  cursor: cell;
}

/* FreeHand Yüzer Pencereleri Genel Yapı */
.fh-floating-win {
  position: fixed;
  background: var(--fh-win-bg);
  border: 2px outset #ffffff;
  box-shadow: 2px 3px 10px rgba(0,0,0,0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
  font-size: 11px;
  color: #000;
  z-index: 28;
  user-select: none;
  -webkit-user-select: none;
}

.fh-win-titlebar {
  height: 18px;
  background: linear-gradient(90deg, var(--fh-win-title-start) 0%, var(--fh-win-title-end) 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-weight: bold;
  font-size: 10px;
  cursor: move;
}

.fh-win-titlebar .fh-win-controls {
  display: flex;
  gap: 2px;
}

.fh-win-btn {
  width: 13px;
  height: 13px;
  background: #d4d0c8;
  border: 1px outset #fff;
  color: #000;
  font-size: 9px;
  line-height: 11px;
  text-align: center;
  cursor: pointer;
  border-radius: 1px;
}

.fh-win-btn:active {
  border: 1px inset #666;
}

/* 1. Tools Paneli (Sol Araç Kutusu - Sol Şeride Engel Olmaz) */
#fh-win-tools {
  top: 60px;
  left: 56px;
  width: 72px;
}

.fh-tools-grid-mx {
  display: grid;
  grid-template-columns: 30px 30px;
  gap: 2px;
  padding: 3px;
  background: #d4d0c8;
}

.fh-tool-icon-btn {
  width: 30px;
  height: 26px;
  background: #ece9d8;
  border: 1px outset #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.fh-tool-icon-btn:hover {
  background: #fbfaf8;
}

.fh-tool-icon-btn.active {
  background: #c0bcb0;
  border: 1px inset #606060;
}

.fh-ico {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  display: inline-block;
  vertical-align: middle;
  pointer-events: none;
}

.fh-tools-section-title {
  grid-column: span 2;
  font-size: 9px;
  text-align: center;
  color: #555;
  background: #e0ded6;
  padding: 1px 0;
  margin-top: 2px;
  border-top: 1px solid #b0aca0;
}

/* Color Well */
.fh-tools-color-well {
  grid-column: span 2;
  height: 38px;
  position: relative;
  background: #d4d0c8;
  border: 1px inset #888;
  margin: 2px 0;
}

.fh-well-stroke-box {
  position: absolute;
  top: 4px;
  left: 8px;
  width: 20px;
  height: 20px;
  background: #000000;
  border: 1px solid #333;
  z-index: 2;
  cursor: pointer;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.fh-well-fill-box {
  position: absolute;
  bottom: 4px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #ffd100;
  border: 1px solid #333;
  z-index: 1;
  cursor: pointer;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 2. Properties Paneli (Sağ Üst - Sağ Çekmece Butonlarına Engel Olmaz) */
#fh-win-properties {
  top: 60px;
  right: 52px;
  width: 260px;
}

.fh-tabs-bar {
  display: flex;
  background: #d4d0c8;
  padding-left: 4px;
  border-bottom: 1px solid #7f9db9;
}

.fh-tab-btn {
  padding: 3px 8px;
  background: var(--fh-tab-inactive);
  border: 1px solid #7f9db9;
  border-bottom: none;
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  margin-right: 2px;
  margin-top: 2px;
}

.fh-tab-btn.active {
  background: var(--fh-tab-active);
  font-weight: bold;
  border-bottom: 1px solid #ffffff;
  margin-bottom: -1px;
}

.fh-tab-content {
  display: none;
  padding: 6px;
  background: #ffffff;
  min-height: 120px;
  max-height: 180px;
  overflow-y: auto;
}

.fh-tab-content.active {
  display: block;
}

.fh-prop-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 10px;
}

.fh-prop-label {
  color: #666;
}

.fh-prop-val {
  font-family: monospace;
  font-weight: 500;
}

/* 3. Mixer & Layers Paneli (Sağ Orta) */
#fh-win-mixer {
  top: 280px;
  right: 52px;
  width: 260px;
}

.fh-cmyk-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10px;
}

.fh-cmyk-label {
  width: 14px;
  font-weight: bold;
}

.fh-cmyk-slider {
  flex: 1;
  height: 12px;
}

.fh-cmyk-val {
  width: 24px;
  text-align: right;
  font-family: monospace;
}

.fh-cmyk-preview {
  height: 24px;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  margin-top: 6px;
}

/* Layers Tab */
.fh-layer-item {
  display: flex;
  align-items: center;
  padding: 4px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.fh-layer-item:hover {
  background: #eef4fc;
}

.fh-layer-vis {
  margin-right: 6px;
  cursor: pointer;
}

/* 4. Assets & Swatches Paneli (Sağ Alt) */
#fh-win-assets {
  top: 480px;
  right: 52px;
  width: 260px;
}

.fh-swatch-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fh-swatch-row {
  display: flex;
  align-items: center;
  padding: 3px 6px;
  cursor: pointer;
  border-radius: 2px;
  gap: 8px;
}

.fh-swatch-row:hover {
  background: #d4e5ff;
}

.fh-swatch-color {
  width: 16px;
  height: 16px;
  border: 1px solid #333;
}

.fh-swatch-name {
  font-size: 10px;
  font-weight: 500;
}

/* 5. Xtra Operations Paneli (Üst Orta) */
#fh-win-xtra {
  top: 60px;
  left: 100px;
  width: 170px;
}

.fh-xtra-grid {
  display: grid;
  grid-template-columns: repeat(5, 28px);
  gap: 3px;
  padding: 4px;
  background: #d4d0c8;
}

#fh-drawings-group [data-selected="true"] {
  outline: 1.5px dashed #0055ea;
  filter: drop-shadow(0 0 3px #0055ea);
}

.fh-task-row:hover {
  background: #f1f5f9;
}

.fh-xtra-btn {
  width: 28px;
  height: 26px;
  background: #ece9d8;
  border: 1px outset #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

.fh-xtra-btn:hover {
  background: #ffffff;
}

.fh-xtra-btn:active {
  border: 1px inset #666;
}

/* Üst FreeHand Rozet & Kontrol Barı (Sağ Çekmece Butonlarına Alan Bırakır) */
#fh-top-bar {
  position: sticky;
  top: 0;
  z-index: 29;
  background: linear-gradient(180deg, #f7f5ed 0%, #e0ded6 100%);
  border-bottom: 1px solid #7f9db9;
  padding: 2px 48px 2px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}

.fh-top-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fh-btn-flat {
  padding: 2px 8px;
  background: #ece9d8;
  border: 1px solid #7f9db9;
  border-radius: 2px;
  cursor: pointer;
  font-size: 10px;
  text-decoration: none;
  color: #000;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fh-btn-flat:hover {
  background: #ffffff;
}

/* FreeHand Seçili Kart Efekti */
.fh-selected-card {
  outline: 2px dashed #0055ea !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 10px rgba(0, 85, 234, 0.45) !important;
  position: relative;
}

.fh-selected-card::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 7px;
  height: 7px;
  background: #0055ea;
  border: 1px solid #fff;
}

/* Connector Kaynak Kartı */
.fh-connector-source {
  outline: 2px solid #ff8200 !important;
  outline-offset: 3px !important;
}

/* Text2Vec Vektörel Not (FreeHand Post-it) */
.fh-vector-note {
  position: absolute;
  min-width: 140px;
  max-width: 260px;
  min-height: 50px;
  background: #fff9c4;
  color: #333333;
  border: 1px solid #fbc02d;
  box-shadow: 2px 3px 8px rgba(0,0,0,0.22);
  padding: 6px 8px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  line-height: 1.35;
  border-radius: 2px;
  z-index: 85;
  cursor: text;
  outline: none;
}

.fh-vector-note:focus {
  border-color: #f57f17;
  box-shadow: 0 0 6px rgba(245, 127, 23, 0.5);
}

#fh-canvas-overlay.tool-active {
  pointer-events: auto;
  cursor: crosshair;
}

/* Meclis görünümü altında FreeHand stüdyo ve araçlarının görünürlük önceliği */
html body[data-oda-view="meclis"] > #fh-canvas-overlay.pen-active,
html body[data-oda-view="meclis"] > #fh-canvas-overlay.tool-active,
html body[data-oda-view="meclis"] > #fh-canvas-overlay.eraser-active {
  display: block;
}

html body[data-oda-view="meclis"] > #fh-top-bar {
  display: flex;
}

/* Kapanmış veya gizlenmiş pencereler her koşulda gizli kalmalıdır */
.fh-floating-win[hidden],
.fh-floating-win.fh-closed,
html body[data-oda-view="meclis"] > .fh-floating-win[hidden],
html body[data-oda-view="meclis"] > .fh-floating-win.fh-closed {
  display: none !important;
}

/* Mobil 390px ve dar ekran uyumu */
@media (max-width: 640px) {
  .fh-floating-win {
    max-width: calc(100vw - 64px);
    left: 56px !important;
    right: auto !important;
  }
  #fh-win-properties,
  #fh-win-mixer,
  #fh-win-assets,
  #fh-win-xtra {
    display: none;
  }
  #fh-win-properties.fh-mobile-open {
    display: block !important;
    top: 60px !important;
  }
  #fh-top-bar {
    max-width: 100vw;
    overflow-x: auto;
    padding-right: 48px;
  }
}

.fh-stamp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #16a34a;
  color: #ffffff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  margin-top: 4px;
  border: 1px solid #15803d;
  animation: fhStampPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fh-task-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #2563eb;
  color: #ffffff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  margin-top: 4px;
  border: 1px solid #1d4ed8;
}

@keyframes fhStampPop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Native Oda controls remain reachable beside the FreeHand floating windows. */
html body:has(#fh-top-bar) #oda-sag-cekmece-dugmeler,
html body:has(#fh-top-bar) #oda-sag-cekmece,
html body:has(#fh-top-bar) #oda-fh-dugme,
html body:has(#fh-top-bar) #oda-fh-panel,
html body:has(#fh-top-bar) #oda-ozellik-paneli-dugme,
html body:has(#fh-top-bar) #oda-ozellik-paneli { z-index:150!important; }
html body:has(#fh-top-bar) #fh-win-tools { margin-left:50px; }
