/* ============================
   VARIABLES & RESET
   ============================ */
:root {
    --primary: #FF6B00;
    --primary-dark: #E55D00;
    --primary-light: #FFF0E5;
    --secondary: #1B2A4A;
    --secondary-light: #2A3F6B;
    --success: #28A745;
    --pickup-color: #FF6B00;
    --delivery-color: #E91E63;
    --bg-light: #F5F7FA;
    --bg-white: #FFFFFF;
    --text-dark: #1a1a2e;
    --text-gray: #6B7280;
    --text-light: #9CA3AF;
    --border: #E5E7EB;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* ============================
   HEADER
   ============================ */
.header {
    background: var(--secondary);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
    color: var(--primary);
    animation: truckMove 2s ease-in-out infinite;
}

@keyframes truckMove {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-8px); }
}

.logo-text {
    font-size: 28px;
    font-weight: 900;
    color: var(--bg-white);
    letter-spacing: -1px;
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a:hover {
    color: var(--primary);
}

/* ============================
   HERO
   ============================ */
.hero {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    padding: 50px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(233, 30, 99, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-title {
    font-size: 42px;
    font-weight: 900;
    color: var(--bg-white);
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.highlight {
    color: var(--primary);
    position: relative;
}

.hero-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* ============================
   MAIN ORDER SECTION
   ============================ */
.main-section {
    padding: 40px 0 60px;
    margin-top: -30px;
    position: relative;
    z-index: 2;
}

.order-wrapper {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 25px;
    align-items: start;
}

/* ============================
   ORDER PANEL (FORM)
   ============================ */
.order-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--bg-light);
}

.panel-header i {
    font-size: 22px;
    color: var(--primary);
}

.panel-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary);
}

/* Input Groups */
.input-group {
    margin-bottom: 8px;
    position: relative;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.label-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.pickup-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.delivery-icon {
    background: #FCE4EC;
    color: var(--delivery-color);
}

.input-wrapper {
    display: flex;
    gap: 8px;
    position: relative;
}

.input-wrapper input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: var(--text-dark);
    transition: var(--transition);
    outline: none;
    background: var(--bg-light);
}

.input-wrapper input:focus {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.1);
}

.input-wrapper input::placeholder {
    color: var(--text-light);
}

.btn-map-select {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--text-gray);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.btn-map-select:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

.btn-map-select.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.2);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(255, 107, 0, 0.1); }
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}

.search-results.show {
    display: block;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--bg-light);
}

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

.search-result-item:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.search-result-item i {
    color: var(--primary);
    font-size: 14px;
    flex-shrink: 0;
}

/* Coords Info */
.coords-info {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 18px;
}

.coords-info.has-coords {
    color: var(--success);
}

/* Connector Line */
.connector-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 4px 0;
    color: var(--text-light);
}

.connector-line .line {
    width: 2px;
    height: 12px;
    background: var(--border);
    border-radius: 1px;
}

.connector-line i {
    font-size: 14px;
    margin: 2px 0;
    color: var(--primary);
}

/* Route Info Box */
.route-info-box {
    background: linear-gradient(135deg, var(--primary-light), #FFF5EB);
    border: 1px solid rgba(255, 107, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 18px 0;
    animation: slideUp 0.4s ease;
}

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

.route-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.route-info-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.route-info-icon.time-icon {
    background: var(--secondary);
}

.route-info-data {
    display: flex;
    flex-direction: column;
}

.route-info-label {
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 600;
}

.route-info-value {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-dark);
}

.route-info-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 107, 0, 0.25);
    margin: 0 16px;
}

/* Loading dots */
.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 600;
}

.loading-dots::after {
    content: '';
    display: inline-block;
    width: 14px;
    overflow: hidden;
    animation: dotsAnim 1.2s steps(4, end) infinite;
}

@keyframes dotsAnim {
    0%  { width: 0; }
    25% { width: 4px; }
    50% { width: 8px; }
    75% { width: 12px; }
    100%{ width: 0; }
}

/* Route loading spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 0, 0.35);
}

.btn-submit:active {
    transform: translateY(0);
}

/* ============================
   MAP PANEL
   ============================ */
.map-panel {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

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

.map-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-title i {
    color: var(--primary);
    font-size: 20px;
}

.map-title h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary);
}

.mode-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.mode-badge.selecting-pickup {
    background: var(--primary-light);
    color: var(--primary-dark);
    animation: badgePulse 1.5s infinite;
}

.mode-badge.selecting-delivery {
    background: #FCE4EC;
    color: var(--delivery-color);
    animation: badgePulse 1.5s infinite;
}

@keyframes badgePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#map {
    width: 100%;
    height: 500px;
    z-index: 1;
}

.map-legend {
    padding: 12px 24px;
    display: flex;
    gap: 24px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-gray);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.pickup-dot {
    background: var(--pickup-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.2);
}

.delivery-dot {
    background: var(--delivery-color);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.2);
}

/* ============================
   MODAL
   ============================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 40px;
    max-width: 450px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.4s ease;
    box-shadow: var(--shadow-lg);
}

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

.modal-icon {
    font-size: 60px;
    color: var(--success);
    margin-bottom: 16px;
}

.modal h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 20px;
}

.modal-details {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    text-align: right;
}

.modal-detail-row {
    display: flex;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.modal-detail-row:last-child {
    border-bottom: none;
}

.modal-detail-row .label {
    font-weight: 700;
    color: var(--text-gray);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pickup-color {
    color: var(--pickup-color);
}

.delivery-color {
    color: var(--delivery-color);
}

.modal-message {
    color: var(--text-gray);
    font-size: 14px;
    margin-bottom: 24px;
}

.btn-modal-close {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-modal-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 0, 0.35);
}

/* ============================
   FOOTER
   ============================ */
.footer {
    background: var(--secondary);
    padding: 20px 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-top: 40px;
}

/* ============================
   LEAFLET CUSTOM STYLES
   ============================ */
.custom-marker-pickup,
.custom-marker-delivery {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
    font-size: 16px;
    color: white;
}

.custom-marker-pickup {
    background: var(--pickup-color);
}

.custom-marker-delivery {
    background: var(--delivery-color);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--secondary);
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    z-index: 3000;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.4s ease;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast i {
    color: var(--primary);
    font-size: 18px;
}

/* ============================
   SCROLLBAR
   ============================ */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ============================
   HAMBURGER BUTTON
   ============================ */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: var(--transition);
}

.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================
   MY LOCATION BUTTON
   ============================ */
.btn-my-location {
    width: 100%;
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-my-location:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(27, 42, 74, 0.35);
}

.btn-my-location:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Delivery My Location button variant */
.btn-my-location-delivery {
    background: linear-gradient(135deg, var(--delivery-color), #c2185b);
}

.btn-my-location-delivery:hover {
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.35);
}

/* Price Icon */
.route-info-icon.price-icon { background: var(--success); }

/* ============================
   ORDER NUMBER BADGE
   ============================ */
.order-number-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 700;
    padding: 5px 18px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

/* ============================
   HISTORY SECTION
   ============================ */
.history-section {
    padding: 0 0 50px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--border);
}

.history-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.btn-clear-history {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-gray);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-clear-history:hover {
    border-color: #dc3545;
    color: #dc3545;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.history-item {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.history-order-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.history-details { margin-bottom: 10px; }

.history-row {
    font-size: 13px;
    color: var(--text-dark);
    padding: 3px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-row i { flex-shrink: 0; margin-top: 2px; }

.history-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 600;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.history-meta i { color: var(--primary); }

.history-date {
    margin-right: auto;
    color: var(--text-light);
}

/* ============================
   RESPONSIVE
   ============================ */
@media (max-width: 900px) {
    .order-wrapper {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 30px;
    }

    .hero-subtitle {
        font-size: 15px;
    }

    #map {
        height: 400px;
    }
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: var(--secondary);
        flex-direction: column;
        gap: 0;
        padding: 10px 20px 20px;
        border-top: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 8px 20px rgba(0,0,0,0.25);
        z-index: 999;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 12px 0;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        font-size: 15px;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }
}

@media (max-width: 600px) {
    .hero {
        padding: 30px 0 45px;
    }

    .hero-title {
        font-size: 26px;
    }

    .order-panel {
        padding: 20px;
    }

    .map-header {
        flex-direction: column;
        gap: 10px;
    }

    #map {
        height: 350px;
    }

    .modal {
        padding: 25px;
    }

    .route-info-box {
        flex-wrap: wrap;
        gap: 10px;
    }

    .route-info-divider {
        display: none;
    }

    .route-info-item {
        flex: 1 1 40%;
    }
}
