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

:root {
    --primary: #0f4c75;
    --primary-dark: #1a1a2e;
    --primary-light: #3282b8;
    --accent: #e8b931;
    --accent-dark: #c9a020;
    --success: #2ecc71;
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
    min-height: 100vh;
}

/* === Header === */
.header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

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

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

.logo-icon {
    width: 42px;
    height: 42px;
    color: var(--accent);
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.7);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-badge {
    background: rgba(232,185,49,0.15);
    border: 1px solid rgba(232,185,49,0.3);
    border-radius: 20px;
    padding: 4px 12px;
}

.header-badge span {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.hero p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.5;
}

/* === Calculator === */
.calculator-section {
    padding: 20px;
    margin-top: -16px;
    position: relative;
    z-index: 10;
}

.calculator-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow-lg);
}

.calc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--bg);
}

.calc-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.calc-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

/* === Form === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-label svg {
    color: var(--primary-light);
    flex-shrink: 0;
}

.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background: var(--card);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
    transition: var(--transition);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(50,130,184,0.1);
}

/* === Passenger Selector === */
.passenger-selector {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    overflow: hidden;
}

.passenger-btn {
    width: 56px;
    height: 56px;
    border: none;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.passenger-btn:hover {
    background: rgba(15,76,117,0.1);
}

.passenger-btn:active {
    background: rgba(15,76,117,0.2);
    transform: scale(0.95);
}

.passenger-count {
    flex: 1;
    text-align: center;
    padding: 8px;
}

.passenger-count span {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.passenger-count small {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Trip Type === */
.trip-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.trip-btn {
    padding: 14px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.trip-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.trip-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-color: var(--primary);
    color: #fff;
}

.trip-btn.active svg {
    color: #fff;
}

/* === Night Toggle === */
.night-toggle {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

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

.toggle-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-info svg {
    color: var(--primary-light);
    flex-shrink: 0;
}

.toggle-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.toggle-desc {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 28px;
    cursor: pointer;
    transition: var(--transition);
}

.slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    top: 3px;
    left: 3px;
    transition: var(--transition);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.switch input:checked + .slider {
    background: var(--primary-light);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* === Calculate Button === */
.calculate-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: var(--primary-dark);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(232,185,49,0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(232,185,49,0.4);
}

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

/* === Result Card === */
.result-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow-lg);
    margin-top: 16px;
    animation: slideUp 0.4s ease;
    border: 2px solid var(--success);
}

.result-card.hidden {
    display: none;
}

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

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.result-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.result-badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === Route Display === */
.result-route {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
}

.route-point {
    display: flex;
    align-items: center;
    gap: 12px;
}

.route-point small {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.route-point span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.route-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 3px solid;
}

.route-dot.start {
    border-color: var(--primary-light);
    background: #fff;
}

.route-dot.end {
    border-color: var(--success);
    background: #fff;
}

.route-line {
    width: 2px;
    height: 24px;
    background: repeating-linear-gradient(to bottom, var(--text-secondary) 0, var(--text-secondary) 4px, transparent 4px, transparent 8px);
    margin-left: 6px;
    margin-top: 4px;
    margin-bottom: 4px;
}

/* === Result Details === */
.result-details {
    margin-bottom: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.detail-row span:first-child {
    color: var(--text-secondary);
}

.detail-row span:last-child {
    font-weight: 600;
    color: var(--text);
}

/* === Total === */
.result-total {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.total-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.total-amount {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 2px;
}

.total-currency {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-notes {
    background: #fffbeb;
    border-radius: var(--radius-sm);
    padding: 14px;
    border: 1px solid #fde68a;
}

.result-notes p {
    font-size: 0.75rem;
    color: #92400e;
    line-height: 1.5;
    margin-bottom: 4px;
}

.result-notes p:last-child {
    margin-bottom: 0;
}

/* === Rates Section === */
.rates-section {
    padding: 0 20px 20px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card);
    padding: 16px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.section-header:hover {
    box-shadow: var(--shadow-lg);
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 700;
}

.section-header h3 svg {
    color: var(--primary-light);
}

.chevron {
    color: var(--text-secondary);
    transition: var(--transition);
}

.section-header.open .chevron {
    transform: rotate(180deg);
}

.rates-table-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.rates-table-wrapper.open {
    max-height: 3000px;
}

.rates-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 16px 0 8px;
    text-align: center;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

.rates-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    min-width: 400px;
}

.rates-table thead {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.rates-table th {
    padding: 12px 10px;
    color: #fff;
    font-weight: 600;
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.rates-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.rates-table tbody tr {
    background: var(--card);
    transition: var(--transition);
}

.rates-table tbody tr:nth-child(even) {
    background: var(--bg);
}

.rates-table tbody tr:hover {
    background: rgba(50,130,184,0.08);
}

.rates-table td:first-child {
    font-weight: 600;
    color: var(--text);
}

.rates-table td:not(:first-child) {
    color: var(--primary);
    font-weight: 600;
}

/* === Tour Section === */
.tour-section {
    padding: 0 20px 20px;
}

.tour-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.tour-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tour-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.tour-price {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 12px;
}

.tour-price small {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
}

.tour-card p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 20px;
    line-height: 1.5;
}

.tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--accent);
    color: var(--primary-dark);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.tour-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
}

/* === Footer === */
.footer {
    background: var(--primary-dark);
    padding: 32px 20px;
    text-align: center;
}

.footer-content {
    max-width: 320px;
    margin: 0 auto;
}

.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    margin-bottom: 16px;
}

.footer-logo span {
    font-size: 0.85rem;
    font-weight: 600;
}

.footer p {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
    line-height: 1.5;
}

.footer-note {
    font-size: 0.7rem !important;
    color: rgba(255,255,255,0.35) !important;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-links a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

.footer-links span {
    color: rgba(255,255,255,0.2);
}

/* === Error shake === */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.shake {
    animation: shake 0.3s ease;
}

.form-select.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239,68,68,0.1);
}

/* === Responsive === */
@media (min-width: 481px) {
    #app {
        box-shadow: 0 0 60px rgba(0,0,0,0.1);
    }

    body {
        padding: 0;
    }
}

@media (min-width: 768px) {
    body {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding: 20px;
        background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 100%);
    }

    #app {
        border-radius: 24px;
        overflow: hidden;
        margin-top: 20px;
        margin-bottom: 20px;
    }
}

/* === Print styles === */
@media print {
    .header, .hero, .calculate-btn, .tour-section, .footer, .night-toggle, .form-group {
        display: none !important;
    }

    .result-card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}
