/* ==========================================================================
   Konica Minolta Ink Estimation Tool — Modern Dark & Glassmorphism Design
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(23, 32, 54, 0.7);
  --bg-card-hover: rgba(30, 41, 69, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(14, 165, 233, 0.3);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-cyan: #0ea5e9;
  --accent-magenta: #ec4899;
  --accent-yellow: #eab308;
  --accent-black: #94a3b8;

  --c-cyan: #06b6d4;
  --c-magenta: #f43f5e;
  --c-yellow: #eab308;
  --c-black: #475569;

  --brand-blue: #2563eb;
  --brand-gradient: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 50%, #8b5cf6 100%);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(14, 165, 233, 0.25);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(14, 165, 233, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(236, 72, 153, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 50% 85%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Header */
.app-header {
  height: 72px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-engine {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s 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; }
}

/* Layout Container */
.main-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 2rem;
  align-items: start;
}

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

/* Cards & Glassmorphism */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  transition: all 0.25s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-title svg {
  color: var(--accent-cyan);
}

/* Drag & Drop Upload Zone */
.upload-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 2.2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.4);
  transition: all 0.2s ease;
  position: relative;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(14, 165, 233, 0.06);
  box-shadow: var(--shadow-glow);
}

.upload-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  transition: transform 0.2s ease;
}

.upload-dropzone:hover .upload-icon {
  transform: translateY(-3px);
}

.upload-text {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.upload-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sample-files-container {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sample-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-sample {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sample:hover {
  background: rgba(14, 165, 233, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

/* File Selected State */
.file-selected-card {
  display: none;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
  align-items: center;
  justify-content: space-between;
}

.file-info-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--brand-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.file-name {
  font-weight: 600;
  font-size: 0.9rem;
  max-width: 230px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-remove-file {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
}

.btn-remove-file:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Form Controls */
.form-group {
  margin-top: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-select, .form-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

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

.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
}

/* Segmented Button Group */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
  gap: 0.25rem;
  border: 1px solid var(--border-color);
}

.segment-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.25rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.segment-btn.active {
  background: var(--brand-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.ink-price-input {
  position: relative;
}

.ink-price-badge {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.ink-price-badge.cyan { background: var(--c-cyan); }
.ink-price-badge.magenta { background: var(--c-magenta); }
.ink-price-badge.yellow { background: var(--c-yellow); color: #000; }
.ink-price-badge.black { background: var(--c-black); }

.ink-price-field {
  padding-left: 32px !important;
  font-size: 0.85rem;
}

/* Calculate Action Button */
.btn-primary-glow {
  width: 100%;
  margin-top: 1.75rem;
  background: var(--brand-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.btn-primary-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(14, 165, 233, 0.6);
}

.btn-primary-glow:active {
  transform: translateY(0);
}

.btn-primary-glow:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Progress Tracker */
.progress-container {
  display: none;
  margin-top: 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.step-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
}

.pipeline-step.active {
  color: var(--accent-cyan);
}

.pipeline-step.active .step-indicator {
  background: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 0 10px var(--accent-cyan);
}

.pipeline-step.done {
  color: var(--success);
}

.pipeline-step.done .step-indicator {
  background: var(--success);
  color: #ffffff;
}

/* Right Panel: Results & Analytics */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 850px) {
  .hero-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-blue);
}

.kpi-card.cyan::before { background: var(--c-cyan); }
.kpi-card.magenta::before { background: var(--c-magenta); }
.kpi-card.yellow::before { background: var(--c-yellow); }
.kpi-card.success::before { background: var(--success); }

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* CMYK Channels Detail Card */
.cmyk-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .cmyk-detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.channel-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  transition: transform 0.2s ease;
}

.channel-box:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.channel-title {
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.channel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.channel-dot.cyan { background: var(--c-cyan); box-shadow: 0 0 8px var(--c-cyan); }
.channel-dot.magenta { background: var(--c-magenta); box-shadow: 0 0 8px var(--c-magenta); }
.channel-dot.yellow { background: var(--c-yellow); box-shadow: 0 0 8px var(--c-yellow); }
.channel-dot.black { background: var(--c-black); box-shadow: 0 0 8px var(--c-black); }

.channel-cov-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.channel-stat {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

.channel-substat {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.channel-meter {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  margin-top: 0.75rem;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
}

.meter-fill.cyan { background: var(--c-cyan); }
.meter-fill.magenta { background: var(--c-magenta); }
.meter-fill.yellow { background: var(--c-yellow); }
.meter-fill.black { background: var(--c-black); }

/* Interactive Preview & Separation Viewer */
.preview-viewer-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.separation-toggles {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
  gap: 0.25rem;
  border: 1px solid var(--border-color);
}

.sep-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sep-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.sep-btn.active.cyan { background: rgba(6, 182, 212, 0.3); color: var(--c-cyan); }
.sep-btn.active.magenta { background: rgba(244, 63, 94, 0.3); color: var(--c-magenta); }
.sep-btn.active.yellow { background: rgba(234, 179, 8, 0.3); color: var(--c-yellow); }
.sep-btn.active.black { background: rgba(71, 85, 105, 0.5); color: #ffffff; }
.sep-btn.active.tac { background: rgba(239, 68, 68, 0.3); color: var(--danger); }

.preview-canvas-wrapper {
  background: #020617;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
}

.preview-canvas-wrapper img {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.tac-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.5rem 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Export Toolbar */
.export-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn-export {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-export:hover {
  background: rgba(14, 165, 233, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

/* Empty Placeholder State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
}

.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.08);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.empty-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.empty-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 380px;
}
