/* Corsch Preview - Customer Frontend */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-input: #0f1623;
  --accent: #00d4aa;
  --accent-hover: #00eebb;
  --accent-dim: rgba(0, 212, 170, 0.15);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e293b;
  --border-accent: rgba(0, 212, 170, 0.3);
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --info: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* Login Page */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent), #0088ff);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--bg-primary);
  margin-bottom: 16px;
}

.logo h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.code-form {
  margin-bottom: 24px;
}

.code-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-form input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  text-align: center;
  letter-spacing: 4px;
  text-transform: uppercase;
  transition: border-color 0.2s;
}

.code-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.code-form input::placeholder {
  color: var(--text-muted);
  letter-spacing: 2px;
  font-size: 16px;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 20px;
}

.code-form button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #0088ff);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: opacity 0.2s, transform 0.1s;
}

.code-form button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.code-form button:active {
  transform: translateY(0);
}

.code-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.footer-note {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.8;
}

/* App Layout */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-small {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #0088ff);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--bg-primary);
}

.header-left h1 {
  font-size: 18px;
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.draft { background: var(--text-muted); color: #fff; }
.status-badge.preview { background: var(--info); color: #fff; }
.status-badge.feedback { background: var(--warning); color: #000; }
.status-badge.approved { background: var(--success); color: #fff; }
.status-badge.in_progress { background: #8b5cf6; color: #fff; }
.status-badge.completed { background: var(--accent); color: var(--bg-primary); }

.btn-secondary {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Content */
.app-content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.tab-content {
  display: none;
}

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

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.section-card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--accent);
}

.description-text {
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.8;
}

/* Status Timeline */
.status-timeline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  flex-wrap: wrap;
}

.timeline-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 2px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
}

.timeline-dot.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.timeline-dot.done {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

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

.timeline-label.active {
  color: var(--accent);
  font-weight: 500;
}

.timeline-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}

.timeline-line.done {
  background: var(--success);
}

/* Preview */
.preview-controls {
  margin-bottom: 16px;
}

.preview-selector {
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  min-width: 300px;
  cursor: pointer;
}

.preview-selector:focus {
  outline: none;
  border-color: var(--accent);
}

.preview-frame-container {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 600px;
  border: 1px solid var(--border);
}

.preview-frame {
  width: 100%;
  height: 700px;
  border: none;
  display: none;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* Feedback */
.feedback-form textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.feedback-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.feedback-type-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.type-option input[type="radio"] {
  accent-color: var(--accent);
}

.type-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.feedback-actions {
  display: flex;
  gap: 12px;
}

.btn-primary {
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--accent), #0088ff);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover { opacity: 0.9; }

.btn-approve {
  padding: 10px 24px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-approve:hover { opacity: 0.9; }

/* Feedback List */
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feedback-item {
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border);
}

.feedback-item.comment { border-left-color: var(--info); }
.feedback-item.change_request { border-left-color: var(--warning); }
.feedback-item.approval { border-left-color: var(--success); }
.feedback-item.rejection { border-left-color: var(--danger); }

.feedback-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.feedback-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feedback-type.comment { color: var(--info); }
.feedback-type.change_request { color: var(--warning); }
.feedback-type.approval { color: var(--success); }
.feedback-type.rejection { color: var(--danger); }

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

.feedback-message {
  color: var(--text-secondary);
  font-size: 14px;
  white-space: pre-wrap;
}

.muted {
  color: var(--text-muted);
  font-size: 14px;
}

/* Version Info */
.version-details {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.version-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border-accent);
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
}

.version-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.version-description {
  width: 100%;
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

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

/* Image Gallery */
.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.image-gallery-item {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
}

.image-gallery-item:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

.image-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  padding: 8px;
}

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 48px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
  z-index: 10;
  line-height: 1;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-counter {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-secondary);
  font-size: 14px;
  z-index: 10;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
  .login-card {
    padding: 32px 24px;
  }

  .app-header {
    padding: 12px 16px;
    gap: 8px;
  }

  .header-left h1 {
    font-size: 15px;
  }

  .tab-nav {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab {
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .app-content {
    padding: 12px;
  }

  .section-card {
    padding: 16px;
    margin-bottom: 12px;
  }

  .feedback-actions {
    flex-direction: column;
  }

  .feedback-actions button {
    width: 100%;
    text-align: center;
  }

  .preview-selector {
    min-width: 100%;
    font-size: 16px; /* Prevent iOS zoom on focus */
  }

  .preview-frame {
    height: 500px;
  }

  .preview-frame-container {
    min-height: 400px;
  }

  .timeline-line {
    width: 20px;
  }

  .status-timeline {
    gap: 4px;
    padding: 12px 0;
  }

  .timeline-step {
    gap: 4px;
  }

  .timeline-dot {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .timeline-label {
    font-size: 10px;
  }

  .feedback-type-row {
    flex-direction: column;
    gap: 10px;
  }

  .feedback-form textarea {
    font-size: 16px; /* Prevent iOS zoom on focus */
  }

  .image-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 32px;
    padding: 4px 10px;
  }

  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

/* Responsive - Small mobile */
@media (max-width: 480px) {
  .login-card {
    padding: 24px 16px;
    border-radius: var(--radius-sm);
  }

  .logo-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
    border-radius: 12px;
  }

  .logo h1 {
    font-size: 20px;
  }

  .code-form input {
    font-size: 18px;
    padding: 12px 14px;
    letter-spacing: 3px;
  }

  .app-header {
    padding: 10px 12px;
  }

  .logo-small {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border-radius: 8px;
  }

  .header-left {
    gap: 10px;
  }

  .header-left h1 {
    font-size: 14px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-badge {
    font-size: 10px;
    padding: 1px 8px;
  }

  .btn-secondary {
    padding: 6px 12px;
    font-size: 12px;
  }

  .app-content {
    padding: 8px;
  }

  .section-card {
    padding: 12px;
    border-radius: var(--radius-sm);
  }

  .section-card h2 {
    font-size: 14px;
  }

  /* Stack timeline vertically on very small screens */
  .status-timeline {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .timeline-step {
    padding: 6px 0;
  }

  .timeline-line {
    width: 2px;
    height: 16px;
    margin-left: 13px;
  }

  .preview-frame {
    height: 350px;
  }

  .preview-frame-container {
    min-height: 300px;
    border-radius: var(--radius-sm);
  }

  .image-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lightbox-prev,
  .lightbox-next {
    display: none; /* Use swipe gestures on very small screens */
  }

  .feedback-item {
    padding: 12px;
  }

  .feedback-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
