:root {
  --primary: #6c63ff;
  --primary-soft: #eef2ff;
  --background: #f9fafb;
  --surface: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --accent-red: #b91c1c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  min-height: 100vh;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* ==================== Sidebar ==================== */
.sidebar {
  width: 220px;
  background: #fafafa;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding: 0 0.5rem;
}

.brand-logo {
  height: 24px;
  object-fit: contain;
}

.hamburger-btn {
  border: none;
  background: transparent;
  font-size: 1.2rem;
  cursor: pointer;
  color: #6b7280;
  padding: 0.25rem;
}

.hamburger-btn:hover {
  color: #374151;
}

/* User Info Card in Sidebar */
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  background: white;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-user-card:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.user-avatar-sidebar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar-sidebar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-sidebar span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.user-info-sidebar {
  flex: 1;
  min-width: 0;
}

.user-name-sidebar {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-sidebar {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: capitalize;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
  font-weight: 500;
}

.nav-link {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: #4b5563;
  cursor: pointer !important;
  pointer-events: auto !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 6px;
  transition: all 0.15s ease;
  margin-bottom: 0.25rem;
  position: relative;
  z-index: 10;
}

.nav-link:hover {
  background: #f3f4f6;
  color: #111827;
}

.nav-link.active {
  color: var(--accent-red);
  font-weight: 600;
  background: transparent;
}

.sidebar-bottom {
  margin-top: auto;
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.footer-copyright {
  margin-bottom: 1rem;
}

.footer-copyright p {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0.25rem 0;
  line-height: 1.4;
}

.footer-copyright p:first-child {
  font-weight: 500;
}

.iw-logo-bottom {
  max-width: 140px;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

/* ==================== Main Content ==================== */
.main {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow-y: auto;
}

.main-header {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.main-header > div {
  flex: 1;
}

.main-header > button {
  flex-shrink: 0;
  margin-top: 0;
}

.main-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.main-header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

/* ==================== Wizard Steps ==================== */
.wizard-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.wizard-step {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.75rem 1.25rem;
  margin-bottom: -2px;
  font-size: 0.95rem;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wizard-step:hover {
  color: #374151;
  background: #f9fafb;
}

.wizard-step.active {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red);
  font-weight: 600;
}

.wizard-step.completed {
  color: #059669;
}

.step-num {
  background: #f3f4f6;
  color: #6b7280;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.wizard-step.active .step-num {
  background: var(--accent-red);
  color: white;
}

.wizard-step.completed .step-num {
  background: #10b981;
  color: white;
}

/* ==================== Cards ==================== */
.card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.75rem 2rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.card-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border-left: 3px solid #2563eb;
  background: #eff6ff;
  color: #1e40af;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.alert.success-alert {
  border-left-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
}

/* ==================== Upload Box ==================== */
.upload-box {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  background: #f9fafb;
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.upload-box:hover {
  border-color: var(--primary);
  background: #f5f5ff;
}

.upload-box.drag-over {
  border-color: var(--primary);
  background: #eef2ff;
}

.upload-icon {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6366f1;
}

.upload-icon svg {
  width: 48px;
  height: 48px;
}

.upload-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.upload-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.error-message {
  color: #b91c1c;
  font-size: 0.85rem;
  margin-top: 0.65rem;
}

/* Hide empty error messages */
.error-message:empty {
  display: none;
}

.file-info {
  margin-top: 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: 8px;
  background: linear-gradient(to right, #f0f9ff, #e0f2fe);
  border: 1px solid #bae6fd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.file-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.file-name {
  font-weight: 600;
  color: #0c4a6e;
}

.file-size {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.status-pill {
  background: #ecfdf5;
  color: #047857;
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ==================== Buttons ==================== */
.btn {
  border-radius: 8px;
  border: none;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #5652d9);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(108, 99, 255, 0.35);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: var(--primary);
  color: var(--primary);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.actions-row {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

/* ==================== Forms ==================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 1.75rem;
}

/* ==================== Configure Migration Layout ==================== */
.config-section {
  margin-bottom: 1.5rem;
}

.config-section:last-of-type {
  margin-bottom: 0;
}

.config-field-full {
  width: 100%;
}

.config-field {
  flex: 1;
  min-width: 0;
}

.config-section:not(.options-section) {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.config-section:not(.options-section) .config-field-full {
  flex: 1;
}

.options-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.option-item:hover {
  background: #f3f4ff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(108, 99, 255, 0.1);
}

.option-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.option-item span {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  display: block;
}

.required {
  color: #ef4444;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #ffffff;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.option-tile {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f9fafb;
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-tile:hover {
  background: #f3f4ff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(108, 99, 255, 0.15);
}

.option-tile input {
  width: 17px;
  height: 17px;
  cursor: pointer;
}

/* ==================== Summary Table ==================== */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.summary-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.summary-label {
  font-weight: 600;
  color: var(--text-secondary);
  width: 38%;
}

.summary-value {
  color: var(--text-primary);
}

/* ==================== Progress ==================== */
.progress-section {
  margin-top: 1.5rem;
}

.progress-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.3s ease;
}

/* ==================== Metrics ==================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1.75rem;
}

.metric-card {
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--primary);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==================== Toast Notifications ==================== */
.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.25rem;
  min-width: 300px;
  max-width: 400px;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  z-index: 10000;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid #10b981;
}

.toast.hiding {
  animation: slideOutRight 0.3s ease;
}

.toast.success {
  border-left-color: #10b981;
}

.toast.error {
  border-left-color: #ef4444;
}

.toast.warning {
  border-left-color: #f59e0b;
}

.toast.info {
  border-left-color: #3b82f6;
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  transition: all 0.2s;
  margin-top: -0.25rem;
  margin-right: -0.25rem;
}

.toast-close:hover {
  background: #f3f4f6;
  color: #374151;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

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

/* ==================== Modals ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

.modal-body {
  padding: 2rem;
}

/* Help Modal Styles */
.help-section {
  margin-bottom: 2rem;
}

.help-section h3 {
  color: #111827;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.help-section ol,
.help-section ul {
  margin-left: 1.5rem;
  color: #4b5563;
  line-height: 1.8;
}

.help-section details {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

.help-section summary {
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  user-select: none;
}

.help-section details[open] summary {
  margin-bottom: 0.5rem;
  color: var(--accent-red);
}

.help-section details p {
  color: #6b7280;
  margin: 0;
  line-height: 1.6;
}

.help-section a {
  color: var(--accent-red);
  text-decoration: none;
}

.help-section a:hover {
  text-decoration: underline;
}

/* Contact Modal Styles */
.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 0;
}

@media (min-width: 768px) {
  .contact-modal-body {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
    align-items: start;
  }
  
  .contact-info {
    margin-bottom: 0;
  }
}

.contact-card {
  text-align: left;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
  background: white;
}

.contact-card:hover {
  border-color: var(--accent-red);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.contact-icon {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: #6366f1;
}

.contact-icon svg {
  width: 32px;
  height: 32px;
}

.contact-card h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  color: #111827;
}

.contact-card p {
  margin: 0.25rem 0;
  color: #4b5563;
}

.contact-note {
  font-size: 0.85rem;
  color: #9ca3af !important;
  font-style: italic;
}

.contact-form {
  background: #f9fafb;
  padding: 1.5rem;
  border-radius: 12px;
  height: fit-content;
  position: sticky;
  top: 0;
}

.contact-form h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #111827;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #374151;
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Hamburger button - hidden on desktop */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
  padding: 0.5rem;
  margin-left: auto;
}

.hamburger-btn:hover {
  color: var(--primary);
}

/* ==================== Responsive ==================== */
@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    position: relative;
  }
  
  .hamburger-btn {
    display: block;
  }
  
  .sidebar-section {
    margin-bottom: 0;
    display: none;
  }
  
  .sidebar.mobile-open .sidebar-section {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    z-index: 1000;
  }
  
  .sidebar-bottom {
    margin-left: auto;
    border-top: none;
    padding-top: 0;
  }
  
  .main {
    padding: 1.5rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .config-section:not(.options-section) {
    flex-direction: column;
    gap: 1rem;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .wizard-steps {
    overflow-x: auto;
  }
}

@media (max-width: 600px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .options-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== Spinner Animation ==================== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #f3f4f6;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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