/* ========================================
   PieCut - Stylesheet global
   ======================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1a1d23;
  color: #e4e6eb;
  min-height: 100vh;
  line-height: 1.5;
}

a { color: #ff6b35; text-decoration: none; }
a:hover { color: #ff8c5c; }

/* -------- Header -------- */
.app-header {
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  padding: 18px 30px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; color: white; }
.logo-icon {
  width: 38px; height: 38px;
  background: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.logo h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.logo .tagline { font-size: 11px; opacity: 0.9; font-weight: 400; }
.version-badge {
  background: rgba(0,0,0,0.25);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Consolas', monospace;
}

/* -------- Mode selector -------- */
.mode-selector {
  background: #20242c;
  border-bottom: 1px solid #353941;
  padding: 0 30px;
  display: flex;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
}
.mode-tab {
  padding: 14px 26px;
  cursor: pointer;
  font-weight: 600;
  color: #8b92a4;
  border-bottom: 3px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.15s;
  position: relative;
}
.mode-tab-label { font-size: 14px; }
.mode-tab-sub { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.7; }
.mode-tab:hover { color: #e4e6eb; }
.mode-tab.active { color: #ff6b35; border-bottom-color: #ff6b35; }
.mode-tab.disabled { opacity: 0.5; cursor: not-allowed; }
.badge-soon {
  position: absolute;
  top: 6px; right: 6px;
  background: #555;
  color: #ddd;
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* -------- Layout -------- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}
@media (max-width: 1024px) {
  .container { grid-template-columns: 1fr; }
}

/* -------- Cards -------- */
.card {
  background: #252830;
  border: 1px solid #353941;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #8b92a4;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::before {
  content: "";
  width: 3px;
  height: 14px;
  background: #ff6b35;
  border-radius: 2px;
}

/* -------- Form -------- */
.form-row { display: flex; gap: 10px; margin-bottom: 12px; }
.form-group { flex: 1; }
.form-group label {
  display: block;
  font-size: 11px;
  color: #8b92a4;
  margin-bottom: 5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
input[type="number"], input[type="text"], select {
  width: 100%;
  background: #1a1d23;
  border: 1px solid #353941;
  border-radius: 6px;
  padding: 9px 12px;
  color: #e4e6eb;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: #ff6b35; }
.input-with-suffix { position: relative; }
.input-with-suffix .suffix {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  color: #8b92a4;
  font-size: 12px;
  font-family: 'Consolas', monospace;
  pointer-events: none;
}

/* -------- Tabs -------- */
.tabs {
  display: flex;
  background: #1a1d23;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 16px;
}
.tab {
  flex: 1;
  padding: 9px;
  text-align: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #8b92a4;
  transition: all 0.15s;
  user-select: none;
}
.tab.active { background: #ff6b35; color: white; }

/* -------- Toggle -------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
}
.switch {
  width: 42px; height: 22px;
  background: #353941;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.switch.on { background: #ff6b35; }
.switch::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: left 0.2s;
}
.switch.on::after { left: 23px; }
.toggle-help { font-size: 11px; color: #8b92a4; margin-top: -2px; margin-bottom: 4px; }

/* -------- Buttons -------- */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: white;
  border: none;
  padding: 13px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(255,107,53,0.3);
  transition: transform 0.1s, box-shadow 0.2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255,107,53,0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  width: 100%;
  background: transparent;
  color: #8b92a4;
  border: 1px solid #353941;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 8px;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: #8b92a4; color: #e4e6eb; }

/* -------- Preview area -------- */
.preview-area {
  background: #252830;
  border: 1px solid #353941;
  border-radius: 10px;
  overflow: hidden;
}
.preview-header {
  padding: 14px 20px;
  border-bottom: 1px solid #353941;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.preview-header h2 { font-size: 15px; font-weight: 600; }
.preview-tabs { display: flex; gap: 4px; }
.preview-tab {
  padding: 6px 12px;
  background: #1a1d23;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  color: #8b92a4;
  user-select: none;
}
.preview-tab.active { background: #ff6b35; color: white; }

.preview-content {
  padding: 24px;
  background: #f5f5f0;
  color: #222;
  min-height: 480px;
  position: relative;
  background-image:
    linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}
.preview-content svg { display: block; }

/* -------- Stats bar -------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #353941;
  background: #1f2229;
}
.stat { text-align: center; }
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #ff6b35;
}
.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: #8b92a4;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* -------- Info lines (recap) -------- */
.info-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid #2a2e36;
}
.info-line:last-child { border-bottom: none; }
.info-label { color: #8b92a4; }
.info-value { font-weight: 500; color: #ff6b35; font-family: 'Consolas', monospace; }

/* -------- Section divider -------- */
.section-divider {
  margin: 28px 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-divider h3 {
  font-size: 14px;
  color: #8b92a4;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #353941;
}

/* -------- Badges -------- */
.badge {
  display: inline-block;
  background: #ff6b35;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-info { background: #2196f3; }
.badge-green { background: #4caf50; }

/* -------- Tables -------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: #1a1d23;
  color: #8b92a4;
  padding: 9px 10px;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #353941;
}
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #2a2e36;
  font-family: 'Consolas', monospace;
  font-size: 13px;
}
.data-table tr:hover { background: #2a2e36; }
.data-table .cut-num { color: #ff6b35; font-weight: 600; }

/* -------- Errors / messages -------- */
.error-msg {
  background: #3a1a1a;
  border-left: 3px solid #e53935;
  padding: 10px 14px;
  border-radius: 4px;
  color: #ffb3b3;
  font-size: 13px;
  margin: 10px 0;
}
.warning-msg {
  background: #2a1f0d;
  border-left: 3px solid #ff9800;
  padding: 10px 14px;
  border-radius: 4px;
  color: #ffcc80;
  font-size: 12px;
  line-height: 1.5;
}
.info-msg {
  background: #1a2733;
  border-left: 3px solid #2196f3;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #a8c5d8;
  line-height: 1.6;
  margin-bottom: 12px;
}

/* -------- Footer -------- */
.app-footer {
  padding: 18px;
  text-align: center;
  font-size: 11px;
  color: #6b7180;
  display: flex;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid #2a2e36;
  margin-top: 30px;
}
