/* =====================================================================
   Wood Sculpture Slicer - Stylesheet
   Renk paleti: siyah + amber + Inter font, minimal ve sik
   ===================================================================== */

:root {
  --bg:        #0a0a0a;
  --bg-card:   #131313;
  --bg-input:  #1a1a1a;
  --bg-hover:  #1f1f1f;
  --border:    #262626;
  --border-strong: #3a3a3a;
  --text:      #e5e5e5;
  --text-dim:  #888;
  --text-muted:#5a5a5a;
  --accent:    #f59e0b;
  --accent-dim:#a06a06;
  --danger:    #ef4444;
  --success:   #10b981;
  --radius:    8px;
  --radius-sm: 4px;
  --shadow:    0 1px 2px rgba(0,0,0,0.5);
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =====================================================================
   Topbar
   ===================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 15px;
}

.logo {
  font-size: 20px;
  color: var(--accent);
  line-height: 1;
}

.accent { color: var(--accent); }

.topnav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--transition);
}
.topnav a:hover { color: var(--text); }

/* =====================================================================
   Layout
   ===================================================================== */
.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* =====================================================================
   Card
   ===================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-title {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

/* =====================================================================
   Dropzone
   ===================================================================== */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 32px 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  background: var(--bg-input);
}

.dropzone:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.dropzone.dragging {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.05);
}

.dropzone-icon {
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.dropzone-text {
  font-size: 13px;
  color: var(--text);
}

.muted {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

/* =====================================================================
   File info
   ===================================================================== */
.file-info {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.file-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.file-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 250px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: all var(--transition);
}
.btn-icon:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 12px;
}

.kv > div {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.kv dt {
  color: var(--text-dim);
}

.kv dd {
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text);
}

/* =====================================================================
   Forms
   ===================================================================== */
.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input[type="number"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  transition: border-color var(--transition);
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23888' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.radio-row,
.checkbox-row {
  display: flex;
  gap: 8px;
}

.radio,
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

.radio input[type="radio"],
.checkbox input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  cursor: pointer;
  position: relative;
  margin: 0;
  transition: all var(--transition);
}

.radio input[type="radio"] {
  border-radius: 50%;
}
.checkbox input[type="checkbox"] {
  border-radius: 3px;
}

.radio input[type="radio"]:checked,
.checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.radio input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: var(--bg);
  border-radius: 50%;
}

.checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.radio,
.checkbox {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: all var(--transition);
}

.radio:hover,
.checkbox:hover {
  border-color: var(--border-strong);
}

.radio:has(input:checked),
.checkbox:has(input:checked) {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.05);
}

.checkbox-line {
  display: flex !important;
  align-items: flex-start !important;
  gap: 10px !important;
  flex: none !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  font-size: 12px;
  color: var(--text-dim);
}
.checkbox-line:hover {
  border: none !important;
}

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  margin-top: 8px;
}

.btn:hover:not(:disabled) {
  background: #fbbf24;
  transform: translateY(-1px);
}

.btn:disabled {
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #1a1a1a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-download {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-download:hover {
  background: rgba(245, 158, 11, 0.1);
  transform: translateY(-1px);
}

/* =====================================================================
   3D Viewer
   ===================================================================== */
.viewer-3d {
  width: 100%;
  height: 360px;
  background: linear-gradient(180deg, #0e0e0e 0%, #1a1a1a 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.viewer-3d canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.viewer-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* =====================================================================
   Result area
   ===================================================================== */
.result-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.report-grid .stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.report-grid .stat-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.report-grid .stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  color: var(--accent);
  font-weight: 500;
}

.preview-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) {
  .preview-images { grid-template-columns: 1fr; }
}

.preview-block {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.preview-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: block;
}

.preview-block img {
  display: block;
  width: 100%;
  height: auto;
  background: white;
  border-radius: var(--radius-sm);
}

/* =====================================================================
   Plate table
   ===================================================================== */
.plate-table-wrap {
  margin-bottom: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.plate-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.plate-table-header .preview-label {
  margin: 0;
}

.plate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  max-height: 300px;
}

.plate-table thead {
  background: rgba(255, 255, 255, 0.02);
}

.plate-table th {
  text-align: left;
  padding: 8px 16px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.plate-table tbody {
  display: block;
  max-height: 280px;
  overflow-y: auto;
}

.plate-table thead,
.plate-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.plate-table td {
  padding: 6px 16px;
  border-top: 1px solid var(--border);
  color: var(--text);
}

.plate-table tbody tr:hover {
  background: var(--bg-hover);
}

/* =====================================================================
   Error box
   ===================================================================== */
.error-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  color: #fca5a5;
  font-size: 12px;
}

/* =====================================================================
   Footer
   ===================================================================== */
.footer {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* =====================================================================
   Utility
   ===================================================================== */
.hidden {
  display: none !important;
}

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }