/* ==========================================================================
   DINO LOGISTICS - SHIPPING RATES UI (CLEAN WHITE & HORIZONTAL LAYOUT)
   Refined for "Simple but Hitting" Look
   ========================================================================== */

/* RESET BOX-SIZING KHUSUS AREA SHIPPING 
   Mencegah padding merusak ukuran lebar maksimal form dan grid */
.shipping-search, .shipping-search *,
.search-card, .search-card *,
#shipping-results, #shipping-results * {
    box-sizing: border-box;
}

:root {
  /* Brand Colors */
  --primary-color: #0554c6;       
  --brand-red: #ef4444;           
  --brand-red-dark: #b91c1c;
  
  /* Backgrounds */
  --page-bg: #f8fafc;             
  --card-bg: #ffffff;             
  
  /* Inputs (Light Theme) */
  --input-bg: #ffffff;            /* Pure White Inputs */
  --input-border: #e2e8f0;        
  --input-text: #0f172a;          
  --input-placeholder: #94a3b8;   
  --input-focus-border: #ef4444;  
  
  /* Text Colors */
  --text-main: #0f172a;
  --text-secondary: #64748b;
  --text-white: #ffffff;

  /* Spacing & Radius */
  --radius-xl: 16px;
  --radius-lg: 10px;
  --radius-md: 8px;
  
  /* Shadows */
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-floating: 0 20px 40px -10px rgba(0, 0, 0, 0.08); /* Sedikit lebih soft */
}

body {
    background-color: var(--page-bg);
}

/* ==========================================================================
   1. PAGE HEADER
   ========================================================================== */
.page-title {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: var(--text-white);
  padding: 100px 0 120px 0; 
  position: relative;
  text-align: left;
}

.page-title::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.6;
}

.page-title h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 10px;
  position: relative;
  z-index: 2;
}

.page-title p {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 400;
  position: relative;
  z-index: 2;
  max-width: 600px;
}

/* ==========================================================================
   2. SEARCH FORM SECTION (HORIZONTAL BAR LAYOUT)
   ========================================================================== */

.section.shipping-search {
  margin-top: -60px; /* Overlap header */
  padding-bottom: 40px;
  position: relative;
  z-index: 10;
}

.search-card {
  background: #0554c6;
  padding: 30px; /* Padding sedikit dikurangi agar compact */
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-floating);
  border: 1px solid rgba(0,0,0,0.05);
  margin-top : 30px;
}

/* --- NEW: GRID LAYOUT SYSTEM --- */
.shipping-form-grid {
    display: grid;
    gap: 16px;
    align-items: flex-end; /* Semua elemen rata bawah */
    width: 100%;
}

/* Responsive Grid Logic */
/* Mobile First: 1 Kolom (Stack) */
.shipping-form-grid {
    grid-template-columns: 1fr;
}

/* Desktop Large (>= 1200px): ONE ROW LAYOUT */
@media (min-width: 1200px) {
    .shipping-form-grid {
        /* Origin | City | District | Village | Weight | Button */
        /* Bobot kolom diatur agar proporsional */
        grid-template-columns: 2fr 2fr 1.5fr 1.5fr 110px 60px;
        gap: 12px;
    }
    
    /* Tombol jadi kotak di desktop */
    .btn-search {
        width: 60px !important;
        padding: 0 !important;
    }
    .btn-text-mobile {
        display: none;
    }
}

/* Tablet / Laptop Kecil (992px - 1199px): 2 Baris */
@media (min-width: 992px) and (max-width: 1199px) {
    .shipping-form-grid {
        grid-template-columns: 1fr 1fr 1fr; /* Baris 1: Asal, Tujuan, Kec */
    }
    /* Item ke-4, 5, 6 pindah ke baris 2 secara alami atau kita atur */
    .form-item-village { grid-column: span 1; }
    .form-item-weight { grid-column: span 1; }
    .form-item-btn { grid-column: span 1; }
}

/* LABEL FORM (Floating look) */
.form-label-custom {
  font-size: 0.7rem; /* Lebih kecil dan rapi */
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  display: block;
  white-space: nowrap; /* Mencegah label turun baris */
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   3. INPUT & SELECT2 FIXES
   ========================================================================== */

.input-group-custom .form-control,
.select2-container--default .select2-selection--single {
  background-color: var(--input-bg) !important;
  border: 1px solid var(--input-border) !important;
  color: var(--input-text) !important;
  height: 50px !important; /* Tinggi standar "Bar" */
  border-radius: var(--radius-md) !important;
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  width: 100%;
}

.input-group-custom .form-control:focus,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--brand-red) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Select2 Rendered Text */
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--input-text) !important;
  padding-left: 0 !important;
  line-height: 48px !important;
}

/* Arrow */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 48px !important;
  right: 10px !important;
}

/* Dropdown */
.select2-dropdown {
  background-color: #ffffff !important;
  border: 1px solid var(--input-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important;
  padding: 5px;
}

.select2-results__option {
  padding: 10px 12px !important;
  font-size: 0.9rem;
  border-radius: 6px;
  margin-bottom: 2px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #fff1f2 !important;
  color: var(--brand-red) !important;
}

/* --- BUTTON SEARCH --- */
.btn-search {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  height: 50px; /* Samakan dengan input */
  width: 100%;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
  cursor: pointer;
}

.btn-search:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.3);
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.btn-search i {
    font-size: 1.1rem;
}

/* ==========================================================================
   4. RESULTS SECTION
   ========================================================================== */

#shipping-results {
  background-color: var(--page-bg);
  padding-top: 20px;
  padding-bottom: 80px;
}

/* Route Info Box */
.shipping-route-info {
  background: white;
  border: 1px solid #e2e8f0;
  border-left: 5px solid var(--brand-red);
  border-radius: var(--radius-lg);
  padding: 24px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.03);
  margin-bottom: 40px;
}

.shipping-route-info h5 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 20px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

/* CARD DESIGN */
.result-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-top: 4px solid var(--brand-red);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.result-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.08);
}

.result-card-header {
  padding: 24px;
  background: #ffffff;
  border-bottom: 1px dashed #e2e8f0;
}

.result-card-header h4 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.service-type {
  display: inline-block;
  background: #fff1f2;
  color: var(--brand-red);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.result-card-body {
  padding: 24px;
  flex-grow: 1;
}

.price-amount {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -1px;
}

.price-currency {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  vertical-align: super;
  margin-right: 4px;
}

.shipping-detail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.detail-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-label i {
  color: var(--brand-red);
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.result-card-footer {
  padding: 24px;
  padding-top: 0;
  margin-top: auto;
}

.btn-choose-service {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  background: #25D366;
  color: white;
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.2);
  transition: all 0.2s;
}

.btn-choose-service:hover {
  background: #1faf54;
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.3);
  transform: translateY(-2px);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: var(--radius-xl);
  border: 1px dashed #cbd5e1;
  grid-column: 1 / -1;
}

.empty-state-icon {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 16px;
    display: block;
}

/* Responsive */
@media (max-width: 1024px) {
  .page-title { padding: 60px 0 100px 0; }
}

@media (max-width: 768px) {
  .search-card { padding: 24px; }
  .page-title { text-align: center; padding-bottom: 120px; }
  .page-title p { margin: 0 auto; }
  .shipping-route-info { flex-direction: column; align-items: flex-start; gap: 10px; }
}