/* RTA Bus Booking Mobile App - Redesigned Flow */

:root {
    --primary: #0300A4;
    --primary-light: #1E1EB8;
    --primary-dark: #020080;
    --accent: #FFB800;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg-primary: #F5F5F7;
    --bg-secondary: #FFFFFF;
    --text-primary: #0A1F44;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --shadow-sm: 0 1px 3px rgba(3, 0, 164, 0.04);
    --shadow-md: 0 4px 12px rgba(3, 0, 164, 0.08);
    --shadow-lg: 0 8px 24px rgba(3, 0, 164, 0.12);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --radius-full: 9999px;
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(180deg, #0300A4 0%, #1E1EB8 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    transition: all 200ms ease;
}

button:active {
    transform: scale(0.98);
}

select {
    font-family: inherit;
    cursor: pointer;
}

.phone-frame {
    width: 100%;
    max-width: 390px;
    height: 844px;
    background: var(--bg-primary);
    border-radius: 44px;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.4), inset 0 0 0 12px #1a1a1a;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.phone-frame::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 32px;
    background: #1a1a1a;
    border-radius: 20px;
    z-index: 100;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 52px 28px 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.battery {
    width: 24px;
    height: 11px;
    border: 2px solid var(--text-primary);
    border-radius: 4px;
    position: relative;
    padding: 1px;
}

.battery::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 5px;
    background: var(--text-primary);
    border-radius: 0 2px 2px 0;
}

.battery-level {
    width: 80%;
    height: 100%;
    background: var(--success);
    border-radius: 2px;
}

/* App Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 14px;
    background: var(--bg-secondary);
}

.app-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

.back-btn:hover {
    background: var(--bg-primary);
}

/* Progress Steps */
.progress-steps {
    display: flex;
    background: var(--bg-secondary);
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-light);
    gap: 4px;
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
}

.step.active {
    opacity: 1;
}

.step.completed {
    opacity: 0.7;
}

.step-num {
    width: 28px;
    height: 28px;
    background: var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}

.step.active .step-num {
    background: var(--primary);
    color: white;
}

.step.completed .step-num {
    background: var(--success);
    color: white;
}

.step-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}

.step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

/* Main Content */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-primary);
}

.screen {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: slideIn 0.3s ease;
}

.screen.active {
    display: flex;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section Title */
.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

/* Trip Type Toggle */
.trip-type-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 5px;
    box-shadow: var(--shadow-sm);
}

.toggle-btn {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

.toggle-btn.active {
    background: var(--primary);
    color: white;
}

/* Form Card */
.form-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group select {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* Quantity Row */
.quantity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quantity-label {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qty-btn {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:disabled {
    background: var(--border);
    color: var(--text-muted);
}

.qty-value {
    font-size: 18px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

/* Primary Button */
.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background: var(--primary);
    color: white;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(3, 0, 164, 0.25);
    margin-top: 8px;
}

.primary-btn:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.primary-btn.success {
    background: var(--success);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.25);
}

.secondary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

/* Calendar */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
}

.month-year {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.nav-arrow {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

.nav-arrow:hover {
    background: var(--bg-primary);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-lg);
}

.weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 4px;
}

.day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
}

.day.disabled {
    color: var(--text-muted);
    opacity: 0.4;
    cursor: default;
}

.day.low {
    background: rgba(34, 197, 94, 0.1);
    color: var(--text-primary);
}

.day.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--text-primary);
}

.day.high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--text-primary);
}

.day.selected {
    background: var(--primary);
    color: white;
}

.day:not(.disabled):not(.selected):hover {
    background: var(--border-light);
}

.calendar-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
}

.dot.low {
    background: var(--success);
}

.dot.medium {
    background: var(--warning);
}

.dot.high {
    background: var(--danger);
}

.dot.soldout {
    background: var(--text-muted);
}

/* Time Selection */
.selected-date-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.time-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.time-slot {
    padding: 12px 8px;
    text-align: center;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 2px solid transparent;
}

.time-slot:hover {
    border-color: var(--primary);
}

.time-slot.selected {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.t-time {
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.t-seats {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.time-slot.selected .t-seats {
    color: rgba(255, 255, 255, 0.7);
}

/* Trip Summary Card */
.trip-summary-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.summary-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.summary-route {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.summary-datetime {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.summary-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.total-price-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
}

.total-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

/* Seat Selection */
.seat-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: var(--radius-md);
}

.seat-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.seat-demo {
    width: 20px;
    height: 20px;
    border-radius: 5px;
}

.seat-demo.available {
    background: var(--bg-primary);
    border: 2px solid var(--border);
}

.seat-demo.selected {
    background: var(--primary);
}

.seat-demo.occupied {
    background: var(--text-muted);
}

.bus-layout {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.bus-front {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--primary);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    color: white;
}

.driver-area {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
}

.door-tag {
    font-size: 11px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
}

.seats-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.seat-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.seat-row.back-row {
    margin-top: 6px;
}

.seat {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.seat.available {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    color: var(--text-secondary);
}

.seat.available:hover {
    border-color: var(--primary);
}

.seat.selected {
    background: var(--primary);
    color: white;
}

.seat.occupied {
    background: var(--text-muted);
    color: white;
    opacity: 0.5;
    cursor: not-allowed;
}

.seat-aisle {
    width: 20px;
}

.selected-seat-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(3, 0, 164, 0.05);
    border: 1px solid rgba(3, 0, 164, 0.1);
    padding: 14px 18px;
    border-radius: var(--radius-md);
}

.seat-badge {
    font-weight: 700;
    color: var(--primary);
    font-size: 15px;
}

.seat-type {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-full);
}

/* Checkout */
.checkout-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 12px;
}

.checkout-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.checkout-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.checkout-item.sub {
    padding: 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.checkout-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.checkout-total {
    display: flex;
    justify-content: space-between;
    padding: 12px 0 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
}

.payment-option.selected {
    border-color: var(--primary);
    background: rgba(3, 0, 164, 0.03);
}

.radio-circle {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
}

.radio-circle.checked {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 4px white;
}

/* Confirmation */
.confirmation-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 0;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    margin-bottom: 20px;
}

.confirmation-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.ticket-card {
    width: 100%;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--primary);
    color: white;
}

.ticket-route {
    font-weight: 700;
}

.ticket-seat {
    font-size: 13px;
    opacity: 0.9;
}

.ticket-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px;
}

.ticket-point {
    text-align: center;
}

.ticket-point .city {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.ticket-point .time {
    display: block;
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 4px;
}

.ticket-arrow {
    font-size: 24px;
    color: var(--text-muted);
}

.ticket-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--bg-primary);
    font-size: 13px;
    color: var(--text-secondary);
}

.confirm-ref {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.confirm-ref strong {
    color: var(--text-primary);
}

@media (max-width: 420px) {
    .phone-frame {
        border-radius: 0;
        height: 100vh;
        max-height: 100vh;
        box-shadow: none;
    }

    .phone-frame::before {
        display: none;
    }

    body {
        padding: 0;
        background: var(--bg-primary);
    }

    .status-bar {
        padding-top: calc(env(safe-area-inset-top, 16px) + 8px);
    }
}