/* ==========================================================================
   İstanbul Gelişim Üniversitesi Staj Dosyası Web & Baskı Stilleri
   ========================================================================== */

:root {
  --primary-color: #1e3a8a;
  --primary-hover: #1e40af;
  --secondary-color: #475569;
  --success-color: #16a34a;
  --warning-color: #d97706;
  --danger-color: #dc2626;
  --bg-workspace: #e2e8f0;
  --card-bg: #ffffff;
  --text-main: #111827;
  --text-muted: #64748b;
  --border-color: #000000;
  --input-focus: #2563eb;
  
  /* A4 Dimensions (Exact Original PDF Source: 210mm x 297mm, 178mm Content Width, 16mm Margins) */
  --a4-width: 210mm;
  --a4-height: 297mm;
  --page-padding-top: 12mm;
  --page-padding-bottom: 10mm;
  --page-padding-left: 16mm;
  --page-padding-right: 16mm;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Times New Roman", Times, "Liberation Serif", serif;
  background-color: var(--bg-workspace);
  color: var(--text-main);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   APP HEADER & TOOLBAR (SCREEN ONLY)
   ========================================================================== */
.app-toolbar {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: #0f172a;
  color: #f8fafc;
  padding: 10px 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.toolbar-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-section img {
  height: 36px;
  background: #ffffff;
  border-radius: 4px;
  padding: 3px 6px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.brand-subtitle {
  font-size: 12px;
  color: #94a3b8;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #1e293b;
  border: 1px solid #334155;
  transition: all 0.25s ease;
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-indicator.saved {
  color: #4ade80;
  border-color: #166534;
  background: rgba(22, 101, 52, 0.2);
}
.status-indicator.saved .dot {
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.status-indicator.saving {
  color: #fde047;
  border-color: #854d0e;
  background: rgba(133, 77, 14, 0.2);
}
.status-indicator.saving .dot {
  background: #eab308;
  animation: pulse 1s infinite;
}

.status-indicator.error {
  color: #f87171;
  border-color: #991b1b;
  background: rgba(153, 27, 27, 0.2);
}
.status-indicator.error .dot {
  background: #ef4444;
}

@keyframes pulse {
  0% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0.3; transform: scale(0.9); }
}

.actions-section {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
}
.btn-primary:hover {
  background: #1d4ed8;
}

.btn-success {
  background: #16a34a;
  color: #ffffff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-secondary {
  background: #334155;
  color: #f1f5f9;
}
.btn-secondary:hover {
  background: #475569;
}

.btn-secondary.active {
  background: #0284c7;
  color: #ffffff;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}
.btn-danger:hover {
  background: #b91c1c;
}

.nav-select {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #f8fafc;
  cursor: pointer;
  outline: none;
}
.nav-select:focus {
  border-color: #3b82f6;
}

/* ==========================================================================
   DOCUMENT WORKSPACE CONTAINER
   ========================================================================== */
.document-container {
  padding: 30px 10px 80px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

/* ==========================================================================
   PHYSICAL A4 PAGE LAYOUT & SAFETY GUIDELINES
   ========================================================================== */
.a4-page {
  width: var(--a4-width);
  min-height: var(--a4-height);
  height: var(--a4-height);
  max-height: var(--a4-height);
  padding: var(--page-padding-top) var(--page-padding-right) var(--page-padding-bottom) var(--page-padding-left);
  background: var(--card-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.08);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  overflow: hidden;
  page-break-after: always;
  break-after: page;
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Safety Guidelines indicator (when toggled) */
.show-safety-guides .a4-page::before {
  content: "A4 Sayfa Sınırı";
  position: absolute;
  top: 4px;
  right: 6px;
  font-family: sans-serif;
  font-size: 9px;
  color: #0284c7;
  border: 1px dashed #0284c7;
  padding: 1px 4px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 100;
}

.show-safety-guides .a4-page {
  outline: 2px dashed #38bdf8;
  outline-offset: -2px;
}

.show-safety-guides .page-content-wrapper {
  background: rgba(56, 189, 248, 0.02);
}

.page-content-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* University Header */
.page-header-container {
  position: relative;
  min-height: 44px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.page-header-logo {
  position: absolute;
  top: 0;
  left: 0;
  height: 42px;
  width: auto;
  object-fit: contain;
}

.page-header-text {
  text-align: center;
  font-weight: bold;
}

.page-footer-number {
  text-align: center;
  font-size: 13px;
  font-weight: normal;
  padding-top: 4px;
  color: #000000;
  flex-shrink: 0;
}

/* ==========================================================================
   PAGE 1: COVER PAGE (KAPAK)
   ========================================================================== */
.cover-header-group {
  text-align: center;
  margin-top: 15px;
  margin-bottom: 30px;
}
.cover-header-group .gov-title {
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.cover-header-group .univ-title {
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.cover-header-group .year-title {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 22px;
}
.cover-header-group .doc-title {
  font-size: 15px;
  font-weight: bold;
  text-decoration: underline;
}

.form-section-title {
  font-size: 13.5px;
  font-weight: bold;
  text-decoration: underline;
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 16px;
  font-size: 13.5px;
}

.form-label {
  width: 170px;
  font-weight: bold;
  flex-shrink: 0;
}

.form-colon {
  margin-right: 12px;
}

.form-input-line {
  flex: 1;
  position: relative;
}

.dotted-input {
  width: 100%;
  border: none;
  border-bottom: 1px dotted #000000;
  font-family: "Times New Roman", Times, serif;
  font-size: 13.5px;
  color: #000000;
  background: transparent;
  padding: 1px 4px;
  outline: none;
}
.dotted-input:focus {
  border-bottom: 1.5px solid #2563eb;
  background: #f8faff;
}

.section-divider-line {
  width: 150px;
  border: none;
  border-top: 1px solid #000000;
  margin: 20px 0 20px 0;
}

/* ==========================================================================
   PAGES 2-6: TEXT REGULATIONS (YÖNERGE & NOTLAR)
   EXACT 10pt ORIGINAL PDF SOURCE FONT SIZE & BALANCED LINE-HEIGHT
   ========================================================================== */
.regulation-content {
  font-family: "Times New Roman", Times, serif;
  font-size: 10pt; /* Exact original PDF source font size */
  line-height: 1.22;
  text-align: justify;
  color: #000000;
}

.regulation-title {
  text-align: center;
  font-size: 12pt;
  font-weight: bold;
  margin-bottom: 14px;
  line-height: 1.3;
}

.regulation-section-header {
  text-align: center;
  font-weight: bold;
  font-size: 10.5pt;
  margin-top: 6px;
  margin-bottom: 2px;
}

.regulation-article-title {
  font-weight: bold;
  font-size: 10pt;
  margin-top: 4px;
  margin-bottom: 1px;
}

.instruction-list {
  list-style: none;
  padding-left: 0;
  font-size: 11pt;
  line-height: 1.4;
}
.instruction-list > li {
  margin-bottom: 12px;
  text-align: justify;
}
.instruction-sublist {
  list-style: disc;
  padding-left: 28px;
  margin-top: 6px;
  margin-bottom: 6px;
}
.instruction-sublist li {
  margin-bottom: 4px;
}

/* ==========================================================================
   PAGES 3-6: STAJ YÖNERGESİ METİNLERİ
   EXACT SAME ORIGINAL PDF FONT SIZE (9.0pt / 12px) ACROSS ALL PAGES
   ========================================================================== */
.regulation-content,
.page-3-regulation,
.page-4-regulation,
.page-5-regulation,
.page-6-regulation {
  font-family: "Times New Roman", Times, "Liberation Serif", serif;
  font-size: 9pt; /* Birebir aynı font boyutu: /F3 12.0005 Tf * 0.75 = 9.0pt (12px) */
  line-height: 1.16;
  text-align: justify;
  color: #000000;
}

.page-3-regulation p,
.page-4-regulation p,
.page-5-regulation p,
.page-6-regulation p {
  margin: 0 0 1.5px 0;
  text-align: justify;
}

.regulation-title {
  text-align: center;
  font-size: 11pt;
  font-weight: bold;
  margin-bottom: 10px;
  line-height: 1.25;
}

.regulation-section-header {
  text-align: center;
  font-weight: bold;
  font-size: 9.5pt;
  margin-top: 3px;
  margin-bottom: 1px;
}

.regulation-article-title {
  font-weight: bold;
  font-size: 9pt;
  margin-top: 2px;
  margin-bottom: 1px;
}

/* ==========================================================================
   PAGE 7: STAJ SİCİL FİŞİ TABLE LAYOUTS
   ========================================================================== */
.sicil-title {
  text-align: center;
  font-size: 13.5px;
  font-weight: bold;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.sicil-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  font-size: 11.5px;
}

.sicil-table th, 
.sicil-table td {
  border: 1px solid #000000;
  padding: 4px 5px;
  vertical-align: middle;
}

.sicil-table .vertical-header {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  width: 22px;
  padding: 4px 2px;
  font-weight: bold;
  font-size: 11px;
}

.table-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  padding: 1px 2px;
}
.table-input:focus {
  background: #eff6ff;
}

.grade-col {
  width: 24px;
  text-align: center;
  padding: 2px !important;
}

.grade-checkbox {
  cursor: pointer;
  width: 14px;
  height: 14px;
}

.group-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.sicil-footer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.sicil-footer-table th,
.sicil-footer-table td {
  border: 1px solid #000000;
  padding: 3px 5px;
  vertical-align: top;
}

/* ==========================================================================
   PAGES 8-37: 30 DAILY WORK REPORTS (GÜNLÜK ÇALIŞMA RAPORU)
   STRICT 228mm A4 HEIGHT & INTERACTIVE POSITION/SIZE CONTROLS
   ========================================================================== */
.report-title-group {
  text-align: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.report-main-title {
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.3px;
}
.report-day-subtitle {
  font-size: 13px;
  font-weight: bold;
  margin-top: 2px;
}

.report-box {
  border: 1px solid #000000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 228mm;
  max-height: 228mm;
  overflow: hidden;
  box-sizing: border-box;
}

.report-meta-header {
  border-bottom: 1px solid #000000;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  flex-shrink: 0;
}

.report-meta-row {
  display: flex;
  align-items: center;
}

.report-meta-label {
  width: 130px;
  font-weight: normal;
  flex-shrink: 0;
}

.report-meta-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  padding: 1px 4px;
}
.report-meta-input:focus {
  background: #eff6ff;
}

.report-body-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 8px;
  position: relative;
  overflow: hidden;
}

.report-textarea {
  width: 100%;
  flex: 1;
  min-height: 50px;
  border: none;
  resize: none;
  background: transparent;
  font-family: "Times New Roman", Times, serif;
  font-size: 12px;
  line-height: 1.48;
  color: #000000;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
}
.report-textarea:focus {
  background: #fafbff;
}

/* Enhanced Media Section with Position & Sizing Controls */
.report-media-section {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 115mm;
  overflow: hidden;
}
.media-pos-top {
  margin-bottom: 6px;
}
.media-pos-bottom {
  margin-top: 6px;
}

.media-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  color: #334155;
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.media-control-label {
  font-weight: 600;
  margin-right: 2px;
  color: #1e293b;
}

.btn-ctrl {
  padding: 2px 8px;
  font-size: 11px;
  border: 1px solid #94a3b8;
  background: #f8fafc;
  color: #1e293b;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-ctrl:hover {
  background: #e2e8f0;
}
.btn-ctrl.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.btn-pos {
  background: #0f766e;
  color: #ffffff;
  border-color: #0d9488;
  font-weight: 600;
}
.btn-pos:hover {
  background: #115e59;
}

.image-size-slider {
  width: 75px;
  height: 4px;
  accent-color: #2563eb;
  cursor: pointer;
}

.size-val {
  font-size: 10px;
  color: #64748b;
  width: 28px;
}

.btn-add-more {
  margin-left: auto;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-add-more:hover {
  background: #047857;
}

/* Image Gallery with Left / Center / Right Alignment */
.image-gallery-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  max-height: 95mm;
  overflow: hidden;
  transition: justify-content 0.2s ease;
}
.image-gallery-container.align-left {
  justify-content: flex-start;
}
.image-gallery-container.align-center {
  justify-content: center;
}
.image-gallery-container.align-right {
  justify-content: flex-end;
}

.report-image-item {
  position: relative;
  display: inline-flex;
  border: 1px solid #94a3b8;
  border-radius: 3px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.report-image-item img {
  display: block;
  height: 95px; /* Default height */
  max-height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.image-delete-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(220, 38, 38, 0.92);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
}
.image-delete-btn:hover {
  background: rgb(185, 28, 28);
  transform: scale(1.15);
}

.upload-dropzone {
  border: 1.5px dashed #94a3b8;
  border-radius: 5px;
  padding: 6px 10px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  color: #475569;
}
.upload-dropzone:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.report-footer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  flex-shrink: 0;
}

.report-footer-table th,
.report-footer-table td {
  border: 1px solid #000000;
  text-align: center;
  padding: 3px 6px;
}

.report-footer-table td {
  height: 42px;
  vertical-align: top;
  font-size: 11px;
}

/* ==========================================================================
   PAGE 38: DEVAM TAKİP ÇİZELGESİ
   ========================================================================== */
.devam-title {
  text-align: center;
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.devam-student-box {
  border: 1px solid #000000;
  padding: 6px 10px;
  margin-bottom: 8px;
  font-size: 11.5px;
  flex-shrink: 0;
}

.devam-table-container {
  display: flex;
  gap: 0;
  width: 100%;
  border: 1px solid #000000;
  border-bottom: none;
  flex: 1;
}

.devam-subtable {
  flex: 1;
  border-collapse: collapse;
  font-size: 11px;
}

.devam-subtable th,
.devam-subtable td {
  border: 1px solid #000000;
  padding: 2.5px 4px;
  text-align: center;
}

.devam-subtable th {
  font-weight: bold;
  background: #ffffff;
}

.devam-summary-text {
  border: 1px solid #000000;
  border-top: none;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.4;
  text-align: justify;
  flex-shrink: 0;
}

.devam-signature-block {
  text-align: right;
  margin-top: 15px;
  padding-right: 30px;
  font-size: 12px;
  font-weight: bold;
  line-height: 1.35;
  flex-shrink: 0;
}

/* ==========================================================================
   PRINT STYLES (@media print) - ZERO OVERFLOW GUARANTEE
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  html, body {
    width: 210mm !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide screen-only elements */
  .no-print,
  .app-toolbar,
  .media-controls,
  .upload-dropzone,
  .image-delete-btn {
    display: none !important;
  }

  .document-container {
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
  }

  .a4-page {
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    padding: var(--page-padding-top) var(--page-padding-right) var(--page-padding-bottom) var(--page-padding-left) !important;
    box-shadow: none !important;
    margin: 0 !important;
    border: none !important;
    outline: none !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }

  .report-box {
    height: 228mm !important;
    max-height: 228mm !important;
    overflow: hidden !important;
  }

  .report-body-container {
    overflow: hidden !important;
  }

  .report-media-section {
    max-height: 95mm !important;
    overflow: hidden !important;
  }

  .image-gallery-container {
    max-height: 95mm !important;
    overflow: hidden !important;
  }

  .dotted-input,
  .table-input,
  .report-meta-input {
    border-bottom-color: #000000 !important;
    background: transparent !important;
  }

  .report-textarea {
    background: transparent !important;
  }

  /* Keep printed borders crisp black */
  .report-box,
  .sicil-table th, 
  .sicil-table td,
  .sicil-footer-table th,
  .sicil-footer-table td,
  .report-meta-header,
  .report-footer-table th,
  .report-footer-table td,
  .devam-student-box,
  .devam-table-container,
  .devam-subtable th,
  .devam-subtable td,
  .devam-summary-text {
    border-color: #000000 !important;
  }
}
