/* ===================== */
/* Metronet Light Theme */
/* ===================== */
:root {
  /* Primary Colors - Metronet Red */
  --primary: #DC143C;
  --primary-dark: #B91030;
  --primary-light: #E8365A;
  --primary-bg: #fef2f4;
  
  /* Neutral Colors */
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-400: #bdbdbd;
  --gray-500: #9e9e9e;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;
  
  /* Status Colors */
  --success: #28a745;
  --success-bg: #d4edda;
  --warning: #f7931e;
  --warning-bg: #fff3cd;
  --error: #dc3545;
  --error-bg: #f8d7da;
  --info: #17a2b8;
  --info-bg: #d1ecf1;
  
  /* Phase Colors */
  --phase-1: #3498db;
  --phase-2: #f7931e;
  --phase-3: #9b59b6;
  --phase-4: #28a745;
  --phase-5: #1f8a70;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition: 200ms ease;
}

/* ===================== */
/* Reset & Base */
/* ===================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--gray-800);
  background: var(--gray-100);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================== */
/* Navigation */
/* ===================== */
.main-nav {
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  border-bottom: 3px solid var(--primary);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  padding: 14px 0;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.nav-brand::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}

.nav-menu {
  list-style: none;
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-menu li a {
  display: block;
  padding: 16px 24px;
  color: var(--gray-600);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition);
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
}

.nav-menu li a:hover {
  color: var(--primary);
  background: var(--primary-bg);
}

.nav-menu li a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-bg);
}

/* User Navigation */
.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 20px;
  border-left: 1px solid var(--gray-200);
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--gray-500);
  background: var(--gray-100);
  border-radius: var(--radius);
  transition: all var(--transition);
  text-decoration: none;
}

.logout-link:hover {
  color: var(--primary);
  background: var(--primary-bg);
}

/* ===================== */
/* Page Container */
/* ===================== */
/* Main content wrapper with form and price summary */
.main-content-wrapper {
  max-width: 1400px;
  margin: 32px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

.container {
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ===================== */
/* Typography */
/* ===================== */
h1 {
  color: var(--gray-900);
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.form-subtitle {
  text-align: center;
  color: var(--gray-600);
  font-size: 0.9rem;
  font-weight: 400;
  padding: 0 32px 16px;
  margin: 0;
  background: var(--white);
  font-style: italic;
}

h2 {
  color: var(--gray-800);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

h2::before {
  content: '';
  width: 4px;
  height: 24px;
  background: var(--primary);
  border-radius: 2px;
}

/* ===================== */
/* Form Sections */
/* ===================== */
.form-section {
  margin: 24px;
  padding: 24px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  position: relative;
}

.form-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

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

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--gray-700);
}

/* Ensure proper alignment for LMS ID label and input */
#lms_id {
  padding-left: 16px;
}

/* ===================== */
/* Customer Type Selector */
/* ===================== */
.customer-type-selector {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.radio-card {
  flex: 1;
  cursor: pointer;
}

.radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  text-align: center;
}

.radio-card-content svg {
  color: var(--gray-500);
  transition: color var(--transition);
}

.radio-card-content span {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.radio-card input[type="radio"]:checked + .radio-card-content {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.radio-card input[type="radio"]:checked + .radio-card-content svg {
  color: var(--primary);
}

.radio-card input[type="radio"]:checked + .radio-card-content span {
  color: var(--primary);
}

.radio-card:hover .radio-card-content {
  border-color: var(--gray-400);
}

.radio-card input[type="radio"]:checked:hover + .radio-card-content {
  border-color: var(--primary-dark);
}

/* ===================== */
/* Checkbox Group */
/* ===================== */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 12px 16px;
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  transition: all var(--transition);
  font-weight: 400;
  margin-bottom: 0;
}

.checkbox-label:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + span {
  color: var(--primary);
  font-weight: 500;
}

.checkbox-label:has(input[type="checkbox"]:checked) {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.checkbox-label span {
  flex: 1;
  color: var(--gray-700);
  transition: color var(--transition);
}

/* TV Tariff Checkbox Group - all tariffs visible in two columns */
.tariff-checkbox-group {
  padding: 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--gray-50);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  /* No max-height - all tariffs visible */
}

.tariff-checkbox-group .checkbox-label {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .tariff-checkbox-group {
    grid-template-columns: 1fr;
  }
}

/* TV Service Sections */
.tv-basic-packages,
.tv-bonus-packages {
  padding: 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--gray-50);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}

.tv-thematic-packages {
  padding: 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: var(--gray-50);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .tv-basic-packages,
  .tv-bonus-packages {
    grid-template-columns: 1fr;
  }
  
  .tv-thematic-packages {
    grid-template-columns: 1fr;
  }
}

/* Radio Label (similar to checkbox-label) */
.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9em;
}

.radio-label:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  margin: 0;
  cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
  font-weight: 600;
  color: var(--primary);
}

.radio-label:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.radio-label span {
  flex: 1;
  color: var(--gray-700);
  transition: color var(--transition);
}

/* Toggle All Button */
.toggle-all-btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-all-btn:hover {
  background: var(--gray-200);
  border-color: var(--primary);
  color: var(--primary);
}

/* ===================== */
/* Form Rows (Side by Side) */
/* ===================== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

/* Form row with buttons (device rows) */
.device-row .form-row {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.form-row .form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.form-row .form-group label {
  margin-bottom: 6px;
}

.form-row .form-group select,
.form-row .form-group input[type="number"] {
  height: 44px !important;
  box-sizing: border-box;
  min-height: 44px;
}

/* Device rows container */
.device-rows-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-row {
  margin-bottom: 0;
}

/* Device row buttons */
.device-row-buttons {
  width: auto;
  display: flex;
  align-items: end;
  gap: 8px;
  margin-bottom: 0;
}

.btn-add-device-row,
.btn-remove-device-row {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.25rem;
  font-weight: 600;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-sizing: border-box;
  line-height: 1;
}

.btn-add-device-row:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-remove-device-row:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-row .form-group:last-child {
    grid-column: 1;
  }
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  
  .form-row-3 {
    grid-template-columns: 1fr;
  }
  
  .customer-type-selector {
    flex-direction: column;
  }
}

/* ===================== */
/* Conditional Fields */
/* ===================== */
.conditional-fields {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================== */
/* Connection Section */
/* ===================== */
.connection-section {
  transition: all 0.3s ease;
}

.connection-section.removing {
  opacity: 0;
  transform: translateX(-20px);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 {
  margin-bottom: 0;
}

.connection-number {
  color: var(--primary);
  font-weight: 700;
}

.btn-remove-connection {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  color: var(--gray-500);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-remove-connection:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

/* ===================== */
/* Form Subsections */
/* ===================== */
.form-subsection {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--gray-300);
}

.form-subsection:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.form-subsection h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

/* ===================== */
/* Add Connection Button */
/* ===================== */
.add-connection-wrapper {
  margin: 0 24px 24px;
  text-align: center;
}

.btn-add-connection {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--white);
  color: var(--primary);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
  max-width: 400px;
}

.btn-add-connection:hover {
  background: var(--primary-bg);
  border-style: solid;
}

.btn-add-connection svg {
  transition: transform var(--transition);
}

.btn-add-connection:hover svg {
  transform: rotate(90deg);
}

/* ===================== */
/* Form Inputs */
/* ===================== */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  transition: all var(--transition);
  outline: none;
  box-sizing: border-box;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--gray-400);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-bg);
}

/* Multiselect styling */
select[multiple] {
  min-height: 120px;
  padding: 8px;
}

select[multiple] option {
  padding: 8px 12px;
  margin: 2px 0;
  border-radius: 4px;
}

select[multiple] option:checked {
  background: var(--primary);
  color: var(--white);
}

.form-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--gray-600);
  font-style: italic;
}

input::placeholder,
textarea::placeholder {
  color: var(--gray-400);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

input[readonly] {
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: not-allowed;
}

/* ===================== */
/* Buttons */
/* ===================== */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(220, 20, 60, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(220, 20, 60, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(220, 20, 60, 0.3);
}

.btn-primary:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-200);
  border-color: var(--gray-400);
}

.form-actions {
  margin: 0;
  padding: 24px 32px;
  background: var(--gray-50);
  text-align: center;
  border-top: 1px solid var(--gray-200);
}

/* ===================== */
/* HubSpot Import Button */
/* ===================== */
.hubspot-import-btn {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition);
}

.hubspot-import-btn:hover {
  background: var(--gray-200);
  border-color: var(--gray-400);
  color: var(--primary);
}

.hubspot-import-btn svg {
  width: 16px;
  height: 16px;
}

/* LMS Import button shares hubspot-import-btn layout but gets a distinct accent on hover. */
.lms-import-btn {
  margin-left: 8px;
}

.lms-import-btn:hover {
  color: #16a34a;
  border-color: #86efac;
  background: #f0fdf4;
}

/* ===================== */
/* LMS Search Autocomplete */
/* ===================== */
.lms-search-results {
  margin-top: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: white;
  display: none;
}

.identity-autocomplete-row .form-group {
  position: relative;
}

.lms-identity-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin-top: 0;
  max-height: 240px;
  z-index: 15;
  box-shadow: var(--shadow-md);
}

.lms-search-results.has-results {
  display: block;
}

.lms-search-results .lms-result-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background var(--transition);
}

.lms-search-results .lms-result-item:last-child {
  border-bottom: none;
}

.lms-search-results .lms-result-item:hover,
.lms-search-results .lms-result-item.is-active {
  background: var(--primary-bg, #eff6ff);
}

.lms-search-results .lms-result-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.95rem;
}

.lms-search-results .lms-result-meta {
  font-size: 0.8rem;
  color: var(--gray-600);
}

.lms-customer-details {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.lms-customer-details .detail-row {
  display: grid;
  gap: 2px;
}

.lms-customer-details .detail-label {
  font-size: 0.78rem;
  color: var(--gray-600);
  font-weight: 600;
}

.lms-customer-details .detail-value {
  color: var(--gray-800);
  font-size: 0.9rem;
  word-break: break-word;
}

.lms-search-empty,
.lms-search-loading {
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--gray-600);
  text-align: center;
}

/* ===================== */
/* Form Toggle (Predvyplň / Vyčisti) */
/* ===================== */
.form-section-header-with-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.form-section-header-with-toggle h2 {
  margin-bottom: 0;
}

.form-toggle-bar {
  display: flex;
  gap: 0;
  background: var(--gray-200);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
}

.form-toggle-btn {
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--gray-600);
  transition: all var(--transition);
}

.form-toggle-btn:hover {
  color: var(--gray-800);
}

.form-toggle-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ===================== */
/* Messages */
/* ===================== */
.message {
  margin: 20px 24px;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.95rem;
  display: none;
}

.message.success {
  background: var(--success);
  color: var(--white);
  display: block;
}

.message.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error);
  display: block;
}

.message.info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info);
  display: block;
}

/* Asana Link in Success Message */
.asana-link {
  display: inline-block;
  color: var(--white);
  background: rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition);
  margin-top: 10px;
}

.asana-link:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ===================== */
/* Modal */
/* ===================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-header h2::before {
  display: none;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.company-option {
  transition: all var(--transition);
}

.company-option:hover {
  border-color: var(--primary) !important;
  background: var(--primary-bg) !important;
}

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

.company-option label {
  cursor: pointer;
}

.form-hint {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--gray-500);
}

/* ===================== */
/* Dashboard */
/* ===================== */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.dashboard-container > h1 {
  text-align: center;
  color: var(--gray-900);
  font-size: 1.75rem;
  margin-bottom: 24px;
  padding: 0;
  border: none;
  background: none;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-header h1 {
  text-align: left;
  color: var(--gray-900);
  font-size: 1.75rem;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

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

.filter-total {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 0.875rem;
  font-weight: 600;
}

.dashboard-delay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  user-select: none;
}

.dashboard-delay-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.dashboard-delay-toggle span {
  white-space: nowrap;
}

.dashboard-filter label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
}

.filter-select {
  padding: 8px 32px 8px 12px;
  font-size: 0.875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-900);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 200px;
}

.filter-select:hover {
  border-color: var(--gray-400);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Stats Cards */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--gray-400);
  transition: all var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card.phase-1 { border-top-color: var(--phase-1); }
.stat-card.phase-2 { border-top-color: var(--phase-2); }
.stat-card.phase-3 { border-top-color: var(--phase-3); }
.stat-card.phase-4 { border-top-color: var(--phase-4); }

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-500);
  margin-top: 4px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.dashboard-column {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.column-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--white);
}

.column-header h2 {
  font-size: 0.9rem;
  margin: 0;
  font-weight: 600;
  color: var(--white);
}

.column-header h2::before {
  display: none;
}

.column-header.phase-1 { background: var(--phase-1); }
.column-header.phase-2 { background: var(--phase-2); }
.column-header.phase-3 { background: var(--phase-3); }
.column-header.phase-4 { background: var(--phase-4); }
.column-header.phase-5 { background: var(--phase-5); }

.column-header .badge {
  background: rgba(255, 255, 255, 0.25);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
}

/* Orders List */
.orders-list {
  padding: 12px;
  max-height: 550px;
  overflow-y: auto;
  background: var(--gray-50);
}

.orders-list .loading,
.orders-list .empty-state,
.orders-list .error-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
  font-size: 0.9rem;
}

.orders-list .error-state {
  color: var(--error);
}

/* Order Card */
.order-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: all var(--transition);
}

.order-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--gray-300);
}

.order-card:last-child {
  margin-bottom: 0;
}

.order-card-offflow-cancelled {
  background: var(--gray-50);
  border-color: var(--gray-300);
  opacity: 0.92;
}

.order-card-offflow-section {
  border-color: var(--warning);
}

.order-offflow-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--gray-200);
  color: var(--gray-800);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-card-offflow-cancelled .order-offflow-badge {
  background: var(--gray-300);
  color: var(--gray-900);
}

.order-card-offflow-section .order-offflow-badge {
  background: #fef3c7;
  color: #92400e;
}

.column-header.phase-offflow {
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}

.order-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 0.95rem;
}

.order-name-clickable {
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px dotted var(--gray-400);
}
.order-name-clickable:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.order-detail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-500);
  padding: 2px;
  border-radius: 4px;
}
.order-detail-icon:hover {
  color: var(--primary);
  background: var(--gray-100);
}

.order-asana-link {
  text-decoration: none;
  font-size: 1.2rem;
  opacity: 0.6;
  transition: all var(--transition);
}

.order-asana-link:hover {
  opacity: 1;
}

.order-asana-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--white);
  background: var(--primary);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all var(--transition);
}

.order-asana-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.order-asana-btn svg {
  flex-shrink: 0;
}

.order-details {
  font-size: 0.8rem;
  color: var(--gray-600);
}

.order-detail {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  line-height: 1.4;
}

.order-created-date {
  color: var(--gray-500);
  font-weight: 500;
}

.order-detail:last-child {
  margin-bottom: 0;
}

.order-detail-asana {
  color: var(--gray-700);
}

.order-detail-asana strong {
  font-weight: 600;
  color: var(--gray-800);
}

.order-asana-comment {
  display: inline;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.order-detail-warning {
  color: var(--warning);
  font-weight: 500;
}

.order-detail-warning .detail-icon {
  opacity: 1;
}

.order-phase-warning-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--warning);
}

.order-phase-warning-icon svg {
  display: block;
}

.detail-icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.order-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-date {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 500;
}

/* Order Actions */
.order-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-update,
.btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-update {
  background: var(--info);
  color: var(--white);
}

.btn-update:hover {
  background: #138496;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-delete {
  background: var(--error);
  color: var(--white);
}

.btn-delete:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-update svg,
.btn-delete svg {
  flex-shrink: 0;
}

.btn-test-coupon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  background: var(--primary);
  color: var(--white);
}

.btn-test-coupon:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-test-coupon:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-test-coupon svg {
  flex-shrink: 0;
}

/* ===================== */
/* Animations */
/* ===================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ===================== */
/* Price Summary Sidebar */
/* ===================== */
.price-summary {
  position: sticky;
  top: 100px;
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

.price-summary-header {
  padding: 20px 24px;
  background: var(--primary);
  color: var(--white);
  border-bottom: 2px solid var(--primary-dark);
}

.price-summary-header h2 {
  color: var(--white);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.price-summary-header h2::before {
  background: var(--white);
  opacity: 0.9;
}

.price-summary-content {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.price-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
}

.price-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.price-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.price-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.price-item.price-discount {
  color: var(--success);
}

.price-value {
  font-weight: 500;
  color: var(--gray-800);
  text-align: right;
}

.price-value.discount {
  color: var(--success);
}

.price-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-top: 8px;
  border-top: 2px solid var(--gray-300);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--gray-800);
}

.price-total-value {
  font-size: 1.1rem;
  color: var(--primary);
}

.price-section-total {
  background: var(--primary-bg);
  padding: 16px;
  border-radius: var(--radius);
  margin-top: 8px;
  border: 2px solid var(--primary);
}

.price-grand-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.price-grand-total-value {
  font-size: 1.5rem;
  color: var(--primary);
  font-weight: 700;
}

/* ===================== */
/* Responsive */
/* ===================== */
@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .dashboard-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1200px) {
  .main-content-wrapper {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .price-summary {
    position: relative;
    top: 0;
    max-height: none;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  .main-content-wrapper {
    padding: 0 16px;
  }
  
  .nav-container {
    padding: 0 16px;
  }
  
  .nav-brand {
    font-size: 1.2rem;
  }
  
  .nav-menu li a {
    padding: 14px 16px;
    font-size: 0.85rem;
  }
  
  .container {
    margin: 0;
    border-radius: var(--radius-lg);
  }
  
  h1 {
    padding: 20px 24px;
    font-size: 1.25rem;
    flex-direction: column;
    gap: 12px;
  }
  
  .form-section {
    margin: 16px;
    padding: 20px;
  }
  
  .form-actions {
    padding: 20px 24px;
  }
  
  .btn-primary,
  .btn-secondary {
    width: 100%;
    padding: 16px 24px;
  }
  
  .dashboard-container {
    padding: 16px;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stat-card:first-child {
    grid-column: span 2;
  }
  
  .modal-content {
    width: 95%;
    margin: 16px;
  }
}

@media (max-width: 480px) {
  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-number {
    font-size: 2rem;
  }
}

/* Order detail popup */
.order-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.order-detail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}
.order-detail-modal-box {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.order-detail-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.order-detail-modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-900);
}
.order-detail-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
}
.order-detail-modal-close:hover {
  color: var(--gray-700);
}
.order-detail-modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.875rem;
  color: var(--gray-700);
}
.order-detail-modal-body .detail-row {
  margin-bottom: 10px;
  line-height: 1.4;
}
.order-detail-modal-body .detail-label {
  font-weight: 600;
  color: var(--gray-600);
  margin-right: 6px;
}
.order-detail-modal-body .order-id-row {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gray-100);
}
.order-detail-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--gray-100);
}

/* ===================== */
/* Scrollbar */
/* ===================== */
.orders-list::-webkit-scrollbar {
  width: 6px;
}

.orders-list::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}

.orders-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.orders-list::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ===================== */
/* Loading State */
/* ===================== */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Focus Visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible {
  outline-offset: 2px;
}

/* ===================== */
/* Custom Selection */
/* ===================== */
::selection {
  background: var(--primary);
  color: var(--white);
}

