/* ==========================================================================
   RUSTEC™ AI CONVERSION ENGINE - Prototyp Laboratoryjny
   Paleta: Dark Industrial High-Tech (#0f1115 / #161a22 / #ff6b00 / #10b981)
   ========================================================================== */

:root {
  --bg-dark: #0a0c10;
  --bg-primary: #0f1115;
  --bg-secondary: #161a22;
  --bg-card: #1c212c;
  --bg-card-hover: #222836;
  --border-color: #2b3242;
  --border-glow: rgba(255, 107, 0, 0.4);
  
  --orange: #ff6b00;
  --orange-hover: #e05e00;
  --orange-glow: rgba(255, 107, 0, 0.25);
  --green: #10b981;
  --green-glow: rgba(16, 185, 129, 0.2);
  --blue: #3b82f6;
  --yellow: #f59e0b;
  --red: #ef4444;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.topbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand-badge {
  background: linear-gradient(135deg, var(--orange), #d9480f);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 1px;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}

.brand-tag {
  color: var(--orange);
  font-size: 13px;
  font-weight: 600;
  background: var(--orange-glow);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-glow);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--green);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Nav Tabs */
.tab-nav {
  display: flex;
  gap: 8px;
  background: var(--bg-dark);
  padding: 12px 28px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-card);
}

.tab-btn.active {
  color: #fff;
  background: var(--bg-card);
  border-color: var(--orange);
  box-shadow: 0 4px 12px var(--orange-glow);
}

/* Main Container */
.main-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px;
  flex: 1;
  width: 100%;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Section */
.hero-box {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.hero-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--orange), transparent);
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #fff;
}

.hero-title span {
  color: var(--orange);
}

.hero-desc {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 800px;
}

/* Diagnostyka Grid */
.diag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

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

.upload-card {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 360px;
}

.upload-card.drag-over {
  border-color: var(--orange);
  background: rgba(255, 107, 0, 0.05);
}

.upload-icon {
  width: 60px;
  height: 60px;
  fill: var(--orange);
  margin-bottom: 16px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange), #e05e00);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--orange-glow);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--orange-glow);
}

/* Sample triggers */
.samples-row {
  margin-top: 20px;
  width: 100%;
}

.samples-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}

.samples-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.sample-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.sample-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: rgba(255, 107, 0, 0.1);
}

/* Image Preview & Scanning Laser */
.preview-container {
  width: 100%;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: none;
}

.preview-img {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-md);
}

.laser-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--orange);
  box-shadow: 0 0 15px 4px var(--orange);
  display: none;
  animation: laserScan 2s infinite ease-in-out;
}

@keyframes laserScan {
  0% { top: 0%; opacity: 0.9; }
  50% { top: 96%; opacity: 1; }
  100% { top: 0%; opacity: 0.9; }
}

.scan-overlay-text {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(10, 12, 16, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--orange);
  font-weight: 700;
  letter-spacing: 0.5px;
  display: none;
}

/* Result Card */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-dim);
  text-align: center;
  padding: 40px 20px;
}

.result-content {
  display: none;
}

.result-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.badge-iso {
  background: rgba(245, 158, 11, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
}

.param-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.param-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.param-box .label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.param-box .value {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.steps-list {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.step-item:last-child {
  margin-bottom: 0;
}

.step-num {
  background: var(--orange);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Recommended Product Banner */
.product-cta-box {
  background: linear-gradient(135deg, rgba(255, 107, 0, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.product-cta-info h4 {
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.product-cta-info p {
  color: var(--text-muted);
  font-size: 12px;
}

.product-cta-price {
  color: var(--green);
  font-weight: 800;
  font-size: 18px;
}

/* Calculator Tab */
.calc-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
}

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

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.form-select, .form-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-select:focus, .form-input:focus {
  border-color: var(--orange);
}

.calc-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 26px;
}

/* Chat Tab */
.chat-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 600px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
}

.chat-msg.bot {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.chat-msg.user {
  background: linear-gradient(135deg, var(--orange), #d9480f);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.chat-chips-bar {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
  overflow-x: auto;
}

.chat-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
}

.chat-chip:hover {
  color: var(--orange);
  border-color: var(--orange);
}

.chat-input-row {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.chat-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  outline: none;
}

.chat-input:focus {
  border-color: var(--orange);
}

/* Code Snippet Box */
.code-box {
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  color: #38bdf8;
  overflow-x: auto;
  line-height: 1.5;
  margin-top: 14px;
}
