/* ============================================
   RuteX — Design System & Styles
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
    /* Primary palette */
    --primary-900: #0d1b3e;
    --primary-800: #132552;
    --primary-700: #1a3570;
    --primary-600: #1e429f;
    --primary-500: #2563eb;
    --primary-400: #5b8def;
    --primary-300: #93bbfd;
    --primary-200: #c3dafe;
    --primary-100: #e8f0fe;
    --primary-50: #f5f8ff;

    /* Accent (orange) */
    --accent-600: #e65100;
    --accent-500: #ff6f00;
    --accent-400: #ff8f00;
    --accent-300: #ffb74d;
    --accent-200: #ffe0b2;
    --accent-100: #fff3e0;

    /* Neutral */
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;

    /* Semantic */
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --error: #dc2626;
    --error-light: #fee2e2;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 10px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 50px -12px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.06);
    --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.08), 0 12px 32px rgba(0,0,0,0.1);

    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --max-width: 1280px;
    --header-height: 64px;
}


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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}


/* ---------- Container ---------- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}


/* ============================================
   HEADER
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    height: var(--header-height);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo-icon {
    display: flex;
    align-items: center;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-700), var(--accent-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 500;
    letter-spacing: 0.02em;
}


/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    position: relative;
    padding: 60px 0 80px;
    overflow: hidden;
}

.hero-bg-pattern {
    position: absolute;
    top: -50%;
    right: -20%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-content {
    text-align: center;
    margin-bottom: 48px;
}

.hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-500), var(--accent-400), var(--primary-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--gray-500);
    max-width: 520px;
    margin: 0 auto;
    font-weight: 400;
}


/* ============================================
   INPUT CARD
   ============================================ */
.input-card {
    max-width: 720px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: box-shadow var(--transition-smooth);
}

.input-card:hover {
    box-shadow: var(--shadow-card-hover);
}

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 6px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.flex-1 {
    flex: 1;
}


/* ---------- Mode Selector ---------- */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--white);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
}

.mode-btn:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
}

.mode-btn.active {
    border-color: var(--primary-500);
    background: var(--primary-50);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.mode-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.mode-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mode-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
}

.mode-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
}


/* ---------- Inputs ---------- */
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--gray-800);
    background: var(--gray-50);
    resize: vertical;
    transition: all var(--transition-base);
    line-height: 1.5;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-400);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.form-textarea::placeholder {
    color: var(--gray-400);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--gray-800);
    background: var(--gray-50);
    transition: all var(--transition-base);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-400);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.time-input {
    max-width: 160px;
}


/* ---------- Generate Button ---------- */
.generate-btn {
    width: 100%;
    padding: 16px 32px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

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

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.generate-btn:disabled::before {
    display: none;
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}


/* ============================================
   RESULTS SECTION
   ============================================ */
.results-section {
    padding: 0 0 80px;
    animation: fadeInUp 0.6s ease-out;
}

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


/* ---------- Summary Bar ---------- */
.summary-bar {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.summary-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.summary-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-900);
}

.new-route-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gray-600);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
}

.new-route-btn:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
    background: var(--primary-50);
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.stat-card {
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    text-align: center;
    transition: transform var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}


/* ---------- Results Layout ---------- */
.results-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}


/* ---------- Itinerary Panel ---------- */
.itinerary-panel {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
    max-height: 80vh;
    overflow-y: auto;
}

.itinerary-panel::-webkit-scrollbar {
    width: 6px;
}

.itinerary-panel::-webkit-scrollbar-track {
    background: transparent;
}

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

.panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 24px;
}


/* ---------- Timeline Items ---------- */
.timeline-item {
    display: flex;
    gap: 16px;
    position: relative;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.timeline-item:hover {
    background: var(--gray-50);
}

.timeline-item.active {
    background: var(--primary-50);
}

.timeline-marker-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 40px;
}

.timeline-marker {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--white);
    background: linear-gradient(135deg, #ff6f00, #ff8f00);
    flex-shrink: 0;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(255, 111, 0, 0.35);
}

.timeline-line {
    width: 3px;
    flex: 1;
    background: #e2e8f0;
    min-height: 24px;
    margin: 4px 0;
}

.timeline-content {
    flex: 1;
    padding-bottom: 12px;
}

.timeline-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.timeline-origin-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 4px;
    font-weight: 500;
}

.text-orange {
    color: #e65100 !important;
    font-weight: 700;
}

.timeline-kategori {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary-600);
    background: var(--primary-100);
    padding: 2px 8px;
    border-radius: 100px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.timeline-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.timeline-meta-item {
    font-size: 0.85rem;
    color: var(--gray-600);
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-meta-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}

.timeline-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    color: var(--accent-500);
    font-weight: 600;
}

.timeline-alasan {
    font-size: 0.8rem;
    color: var(--gray-600);
    line-height: 1.5;
    font-style: italic;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-400);
    margin-top: 8px;
    display: none;
}

.timeline-item:hover .timeline-alasan,
.timeline-item.active .timeline-alasan {
    display: block;
}


/* ---------- Travel Time Badge (Pill Style) ---------- */
.travel-badge-container {
    margin: 8px 0 16px 56px;
}

.travel-time-label {
    font-size: 0.82rem;
    color: #1e3a8a;
    font-weight: 600;
    margin-bottom: 4px;
}

.travel-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #103778;
    color: #ffffff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 6px rgba(16, 55, 120, 0.25);
}

.travel-badge-icon {
    font-size: 1rem;
}

.travel-badge-text {
    color: #ffffff;
}


/* ---------- Map Panel ---------- */
.map-panel {
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

.map-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.google-map {
    width: 100%;
    height: 600px;
}


/* ============================================
   FOOTER
   ============================================ */
.footer {
    text-align: center;
    padding: 32px 24px;
    color: var(--gray-400);
    font-size: 0.8rem;
    border-top: 1px solid var(--gray-100);
}


/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
    .results-layout {
        grid-template-columns: 1fr;
    }

    .map-panel {
        position: relative;
        top: 0;
        order: -1;
    }

    .google-map {
        height: 400px;
    }

    .itinerary-panel {
        max-height: none;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .hero-section {
        padding: 40px 0 60px;
    }

    .input-card {
        padding: 24px;
        border-radius: var(--radius-lg);
    }

    .mode-selector {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
    }

    .time-input {
        max-width: 100%;
    }

    .summary-bar {
        padding: 20px;
    }

    .summary-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .summary-stats {
        grid-template-columns: 1fr 1fr;
    }

    .itinerary-panel {
        padding: 20px;
    }

    .travel-badge {
        margin-left: 44px;
    }

    .google-map {
        height: 300px;
    }

    .header-inner {
        flex-direction: column;
        height: auto;
        padding: 12px 24px;
        gap: 2px;
    }

    .tagline {
        font-size: 0.7rem;
    }
}


/* ============================================
   INFO WINDOW (Google Maps)
   ============================================ */
.info-window {
    padding: 4px;
    max-width: 260px;
}

.info-window-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.info-window-kategori {
    font-size: 0.7rem;
    color: #6b7280;
    margin-bottom: 6px;
}

.info-window-detail {
    font-size: 0.78rem;
    color: #4b5563;
    line-height: 1.4;
}

.info-window-detail p {
    margin: 2px 0;
}


/* ============================================
   SweetAlert2 Overrides
   ============================================ */
.swal2-popup {
    font-family: 'Inter', sans-serif !important;
    border-radius: var(--radius-lg) !important;
}

.swal2-title {
    font-family: 'Outfit', sans-serif !important;
    font-weight: 700 !important;
}
