/**
 * ROUTES ADMIN - Quotation Management Styles
 */

/* ==================== Variables ==================== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-dark: #1e293b;
  
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== Header ==================== */
.admin-header {
  background: linear-gradient(135deg, var(--bg-dark) 0%, #334155 100%);
  color: white;
  padding: 24px 0;
  margin-bottom: 24px;
}

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

.admin-header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-header .logo i {
  font-size: 28px;
  color: var(--primary);
}

.admin-header h1 {
  font-size: 24px;
  font-weight: 600;
}

.admin-header .subtitle {
  opacity: 0.8;
  margin-top: 4px;
  font-size: 14px;
}

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

.back-link {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.2s;
}

.back-link:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==================== Stats Bar ==================== */
.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  flex: 1;
  min-width: 180px;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-card .stat-icon.air { background: #dbeafe; color: var(--primary); }
.stat-card .stat-icon.sea { background: #d1fae5; color: #059669; }
.stat-card .stat-icon.total { background: #fef3c7; color: #d97706; }
.stat-card .stat-icon.expired { background: #fee2e2; color: #dc2626; }

.stat-card .stat-info {
  flex: 1;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ==================== Toolbar ==================== */
.toolbar {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 14px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

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

.filter-group select {
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 14px;
  background: white;
  cursor: pointer;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

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

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

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

.btn-success:hover {
  background: #16a34a;
}

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

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  background: transparent;
  color: var(--text-secondary);
}

.btn-icon:hover {
  background: var(--bg-primary);
}

.btn-icon.btn-edit:hover { color: var(--primary); }
.btn-icon.btn-duplicate:hover { color: var(--info); }
.btn-icon.btn-delete:hover { color: var(--danger); }
.btn-icon.btn-remove { color: var(--danger); }

.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

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

/* ==================== Cards ==================== */
.card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2 i {
  color: var(--primary);
}

/* ==================== Tables ==================== */
.table-container {
  overflow-x: auto;
}

.routes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.routes-table th,
.routes-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.routes-table th {
  background: var(--bg-primary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
}

.routes-table tr:hover {
  background: #f8fafc;
}

.routes-table td {
  vertical-align: middle;
}

.route-id {
  color: var(--text-light);
  font-size: 11px;
  font-family: monospace;
}

.tier-cell {
  max-width: 300px;
}

.tiers-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tier-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
}

.tier-more {
  color: var(--text-light);
  font-size: 11px;
  font-style: italic;
}

.validity {
  white-space: nowrap;
}

.validity.expired {
  color: var(--danger);
}

.validity.expiring {
  color: var(--warning);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
}

.badge-danger {
  background: #fee2e2;
  color: #dc2626;
}

.badge-warning {
  background: #fef3c7;
  color: #d97706;
}

.badge-success {
  background: #d1fae5;
  color: #059669;
}

.actions {
  white-space: nowrap;
}

.no-data {
  text-align: center;
  color: var(--text-light);
  padding: 40px !important;
  font-style: italic;
}

/* ==================== Modal ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.modal-header h2 i {
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-primary);
}

/* ==================== Forms ==================== */
.edit-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-section {
  background: var(--bg-primary);
  border-radius: var(--border-radius);
  padding: 20px;
}

.form-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

.form-section h3 i {
  color: var(--primary);
  font-size: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group input.readonly {
  background: var(--bg-primary);
  color: var(--text-light);
}

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

/* Tier rows */
.tier-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: white;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
}

.tier-row input {
  width: 100px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 13px;
}

.tier-row select {
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 13px;
}

.tier-separator {
  color: var(--text-light);
  font-size: 13px;
}

.tier-unit {
  color: var(--text-secondary);
  font-size: 12px;
}

/* ==================== Notifications ==================== */
#notifications {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--border-radius);
  background: white;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

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

.notification-success { border-left: 4px solid var(--success); }
.notification-error { border-left: 4px solid var(--danger); }
.notification-warning { border-left: 4px solid var(--warning); }
.notification-info { border-left: 4px solid var(--info); }

.notification i:first-child {
  font-size: 18px;
}

.notification-success i:first-child { color: var(--success); }
.notification-error i:first-child { color: var(--danger); }
.notification-warning i:first-child { color: var(--warning); }
.notification-info i:first-child { color: var(--info); }

.notification span {
  flex: 1;
  font-size: 14px;
}

.notification button {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
}

/* ==================== Loading ==================== */
#loadingOverlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  z-index: 9998;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

#loadingOverlay i {
  font-size: 40px;
  color: var(--primary);
  animation: spin 1s linear infinite;
}

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

/* ==================== Tabs ==================== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 24px;
}

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

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

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

.tab i {
  margin-right: 8px;
}

.tab-content {
  display: none;
}

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

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
  .admin-header .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .stats-bar {
    flex-direction: column;
  }
  
  .toolbar {
    flex-direction: column;
  }
  
  .toolbar-actions {
    width: 100%;
    margin-left: 0;
  }
  
  .toolbar-actions .btn {
    flex: 1;
    justify-content: center;
  }
  
  .modal-content {
    max-height: calc(100vh - 40px);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .tier-row {
    flex-wrap: wrap;
  }
}

/* ==================== Footer ==================== */
.footer {
  background: var(--bg-dark);
  color: white;
  padding: 20px 0;
  margin-top: 40px;
  text-align: center;
}

.footer p {
  opacity: 0.8;
  font-size: 14px;
}

.footer a {
  color: white;
  text-decoration: underline;
}
