/* ─── NexToolsX · image-cropper.css (FIXED) ────────────────────────── */

/* ─── Upload Area ───────────────────────────────────────────────────── */
.upload-area {
  width: 100%;
  max-width: 500px;
  min-height: 180px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0 1rem;
}
.upload-area:hover,
.upload-area.dragover,
.upload-area:focus-visible {
  border-color: var(--red);
  background: var(--surface-3);
  outline: none;
}
.upload-content { text-align: center; padding: 1.5rem; }
.upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-text { font-size: 1rem; margin-bottom: 0.25rem; }
.upload-hint { font-size: 0.75rem; color: var(--text-muted); }

/* ─── Crop Workspace ────────────────────────────────────────────────── */
.crop-workspace {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

/* ─── Ratio Bar ─────────────────────────────────────────────────────── */
.ratio-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.ratio-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px);
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text);
  letter-spacing: 0.02em;
}
.ratio-btn:hover {
  border-color: var(--red);
  background: var(--surface-3);
}
.ratio-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 3px 10px rgba(255,0,0,0.25);
}

/* ─── Canvas Wrapper (FIX: was .canvas-container in old CSS) ─────────── */
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 700px;
  background: var(--surface-3, #111);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  user-select: none;
  touch-action: none;
  cursor: crosshair;
  /* Height set dynamically via JS */
}

#cropCanvas {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

/* ─── Crop Overlay  (FIX: was completely missing) ───────────────────── */
.crop-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none; /* children override this */
}

/* ─── Dark Masks (FIX: was completely missing) ──────────────────────── */
.mask {
  position: absolute;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
/* top / bottom span full width; left/right fill gap between them */
.mask-top    { top: 0; left: 0; right: 0; }
.mask-bottom { bottom: 0; left: 0; right: 0; }
.mask-left   { left: 0; }
.mask-right  { right: 0; }

/* ─── Crop Box ──────────────────────────────────────────────────────── */
.crop-box {
  position: absolute;
  border: 2px solid #fff;
  cursor: move;
  box-sizing: border-box;
  pointer-events: all;
}

/* ─── Grid Lines ────────────────────────────────────────────────────── */
.grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.gl-v, .gl-h {
  position: absolute;
  background: rgba(255,255,255,0.2);
}
.gl-v {
  width: 1px;
  height: 100%;
}
.gl-v:nth-child(1) { left: 33.33%; }
.gl-v:nth-child(2) { left: 66.66%; }
.gl-h {
  width: 100%;
  height: 1px;
}
.gl-h:nth-child(3) { top: 33.33%; }
.gl-h:nth-child(4) { top: 66.66%; }

/* ─── Handles  (FIX: HTML uses .h-nw .h-ne etc., old CSS used .tl .tr) */
.handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--red);
  border-radius: 2px;
  z-index: 10;
  pointer-events: all;
}
/* Corners */
.h-nw { top: -6px;    left: -6px;   cursor: nw-resize; }
.h-ne { top: -6px;    right: -6px;  cursor: ne-resize; }
.h-sw { bottom: -6px; left: -6px;   cursor: sw-resize; }
.h-se { bottom: -6px; right: -6px;  cursor: se-resize; }
/* Edges */
.h-n  { top: -6px;    left: 50%; transform: translateX(-50%); cursor: n-resize; }
.h-s  { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.h-w  { top: 50%;     left: -6px;   transform: translateY(-50%); cursor: w-resize; }
.h-e  { top: 50%;     right: -6px;  transform: translateY(-50%); cursor: e-resize; }

/* ─── Dimensions Label ──────────────────────────────────────────────── */
.crop-dims {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

/* ─── Output Controls ───────────────────────────────────────────────── */
.output-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.2rem;
  width: 100%;
}

.oc-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.oc-group select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.3rem 0.6rem;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
}

.oc-group input[type="range"] {
  width: 90px;
  height: 4px;
  -webkit-appearance: none;
  background: var(--surface-3);
  border-radius: 2px;
  cursor: pointer;
}
.oc-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--red);
  border-radius: 50%;
  cursor: pointer;
}

.oc-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.btn-crop {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 0.6rem 1.6rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-crop:hover {
  opacity: 0.85;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(255,0,0,0.3);
}

.btn-reset {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-reset:hover {
  border-color: var(--red);
  background: var(--surface-3);
}

/* ─── Result Area ───────────────────────────────────────────────────── */
.result-area {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}
@media (max-width: 500px) {
  .preview-grid { grid-template-columns: 1fr; }
}

.preview-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
}
.preview-card.highlight {
  border-color: var(--red);
  box-shadow: 0 0 0 1px var(--red), 0 4px 20px rgba(255,0,0,0.15);
}
.preview-card h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.preview-img-wrap {
  max-height: 220px;
  overflow: hidden;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  margin-bottom: 0.6rem;
}
.preview-img-wrap img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}
.file-info {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.btn-download-cropped {
  background: #16a34a;
  color: #fff;
  border: none;
  padding: 0.7rem 2rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-download-cropped:hover {
  background: #22c55e;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(34,197,94,0.3);
}

.btn-crop-another {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-crop-another:hover {
  border-color: var(--red);
  background: var(--surface-3);
}

/* ─── History ───────────────────────────────────────────────────────── */
.history-section {
  width: 100%;
  max-width: 600px;
  margin-top: 1rem;
}
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}
.history-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.history-clear {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.history-clear:hover { border-color: var(--red); color: var(--red); }
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  gap: 0.5rem;
}
.history-filename {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  color: var(--text-muted);
}
.history-dims {
  color: var(--red);
  font-weight: 700;
  white-space: nowrap;
}

/* ─── Error & Back Link ─────────────────────────────────────────────── */
.error-msg {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}
.back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.back-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .output-controls { flex-direction: column; align-items: stretch; }
  .oc-actions { margin-left: 0; }
  .btn-crop, .btn-reset { width: 100%; }
  .result-actions { flex-direction: column; }
  .btn-download-cropped,
  .btn-crop-another { width: 100%; text-align: center; }
  .back-link { display: none; }
}
/* ─── INFO SECTION — tüm sayfalara yapıştır ────────────────────────── */
.info-section {
  width: 100%;
  padding: 4rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.info-inner {
  max-width: 900px;
  margin: 0 auto;
}

.info-inner h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.info-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.info-card:hover {
  border-color: var(--red);
  background: var(--surface-3);
  transform: translateY(-3px);
}

.info-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 0.15rem;
}

.info-card h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.info-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ─── SSS / FAQ Section ──────────────────────────────────────────────── */
.faq-section {
  padding: 4rem 1.5rem;
}

.faq-inner {
  max-width: 720px;
  margin: 0 auto;
}

.faq-inner h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.faq-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.6rem;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.faq-item[open] {
  border-color: var(--red);
}

.faq-item summary {
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--red);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-body {
  padding: 0 1.25rem 1rem;
}

.faq-body p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }
}

@media (max-width: 480px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
  }
  .info-section {
    padding: 2.5rem 1rem;
  }
  .info-inner h2,
  .faq-inner h2 {
    font-size: 1.25rem;
  }
  .info-card {
    padding: 1rem 0.75rem;
    border-radius: 12px;
  }
  .info-icon { font-size: 1.5rem; }
  .info-card h3 { font-size: 0.78rem; }
  .info-card p { font-size: 0.7rem; }
}