@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --primary: #7B4FD8;
    /* Deep professional purple */
    --accent: #1B7340;
    /* Forest green - professional and calm */

    --bg-main: #f8f9fa;
    /* Clean Light Gray/White */
    --bg-card: #ffffff;
    --border-color: #e0e0e0;

    --text-main: #1a1a2e;
    /* Dark Navy/Black */
    --text-muted: #666680;

    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    padding-top: 80px;
    /* More space for cleaner nav */
}

/* Cleaner Nav Bar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text-main);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-item {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    background: none;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--primary);
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Hero Section Refined */
.hero {
    min-height: 45vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #f0f2f5 100%);
}

.hero p {
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.1em;
}

/* Cards & Panels */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
}

/* Search Input */
.search-container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-top: 2rem;
}

.input-group {
    flex: 1;
    position: relative;
}

input {
    width: 100%;
    padding: 1rem 1rem 1rem 2.8rem;
    /* Space for icon */
    background: #f0f2f5;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: all 0.2s;
}

input:focus {
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(123, 79, 216, 0.1);
}

.input-group i {
    color: var(--text-muted);
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--primary), #5a38a3);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 4px 15px rgba(123, 79, 216, 0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 79, 216, 0.35);
}

.track-btn {
    width: 100%;
    padding: 0.8rem;
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.track-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 200, 83, 0.05);
}

/* Result Cards */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.route {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}

.price-tag {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Timeline & Milestones */
.forecast-section {
    border-top: 1px solid var(--border-color);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

.timeline-bar {
    background: #e0e0e0;
}

.milestone {
    background: white;
    border: 2px solid var(--text-muted);
}

.milestone-label {
    color: var(--text-muted);
    font-weight: 500;
}

.milestone-price {
    color: var(--text-main);
    font-weight: 600;
}

/* Modals */
.modal-overlay {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border-color);
}

h1,
h2,
h3 {
    color: var(--text-main);
}

p {
    color: var(--text-muted);
}

/* Fixed Bottom Action Bar */
.bottom-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 2px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.bottom-action-bar.visible {
    transform: translateY(0);
}

.bottom-bar-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.bottom-bar-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bottom-bar-total {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.bottom-bar-total .label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.bottom-bar-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.action-btn {
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    white-space: nowrap;
}

.action-btn.book-now {
    background: var(--text-main);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.action-btn.book-now:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.action-btn.auto-buy {
    background: linear-gradient(135deg, var(--primary), #5a38a3);
    color: white;
    box-shadow: 0 4px 15px rgba(123, 79, 216, 0.25);
}

.action-btn.auto-buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 79, 216, 0.35);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Selected Card State */
.card.selected {
    border: 2px solid var(--primary);
    background: linear-gradient(135deg, rgba(123, 79, 216, 0.03), rgba(90, 56, 163, 0.03));
    box-shadow: 0 4px 20px rgba(123, 79, 216, 0.15);
}

.card.selected::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--primary), #5a38a3);
    border-radius: 16px;
    opacity: 0.1;
    z-index: -1;
}

/* Improved Checkbox Styling */
.leg-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary);
    transform: scale(1.3);
    margin-right: 1rem;
}

.leg-checkbox:hover {
    transform: scale(1.4);
}

/* Purchase Options Modal */
.purchase-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.purchase-modal.visible {
    display: flex;
}

.purchase-modal-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
}

.purchase-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.purchase-modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.purchase-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-main);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.purchase-item-route {
    font-weight: 600;
    color: var(--text-main);
}

.purchase-item-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.purchase-item-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

.purchase-summary {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.purchase-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
}

.purchase-summary-row.total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--border-color);
}

.purchase-summary-label {
    color: var(--text-muted);
}

.purchase-summary-value {
    font-weight: 600;
    color: var(--text-main);
}

.fee-note {
    background: rgba(123, 79, 216, 0.05);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 3px solid var(--primary);
    font-size: 0.9rem;
    color: var(--text-main);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-actions button {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bottom-action-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .bottom-bar-actions {
        width: 100%;
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .purchase-modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}

/* Modal Centering */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 400px;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* Itinerary-based Results */
.itinerary-row {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.3s ease;
}

.itinerary-row.selected {
    background: rgba(0, 255, 255, 0.08); /* Cyan background - matches mockup (B) */
    border-color: #00d4ff;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.15);
}

.itinerary-checkbox {
    margin: 0;
    cursor: pointer;
}

.leg-card {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: rgba(200, 220, 255, 0.15); /* Light blue default */
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 0; /* Allows flex shrinking */
}

.leg-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.leg-card.selected {
    background: rgba(57, 255, 20, 0.15); /* Green highlight - matches mockup (C) */
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(27, 115, 64, 0.2);
}

.leg-card.conflict {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.itinerary-summary {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}

/* Responsive adjustments for itinerary rows */
@media (max-width: 1024px) {
    .itinerary-row {
        flex-wrap: wrap;
    }
    
    .leg-card {
        min-width: 200px;
    }
    
    .itinerary-summary {
        width: 100%;
        text-align: center;
        align-items: center;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--border-color);
    }
}

/* Update conflict state to show red */
.leg-card.conflict {
    background: rgba(255, 71, 87, 0.15) !important; /* Red background for conflicts */
    border-color: #ff4757 !important;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.2) !important;
    opacity: 1 !important;
    cursor: pointer !important;
    filter: none !important;
}

/* Sort button styling */
.sort-btn {
    color: var(--text-main);
}

.sort-btn:hover {
    border-color: var(--primary) !important;
    background: rgba(123, 79, 216, 0.05) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sort-btn.active {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}
