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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    -webkit-text-size-adjust: none;
    -webkit-touch-callout: none;
}

header {
    background: linear-gradient(135deg, #1e3a8a, #3730a3);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.last-updated {
    font-size: 0.875rem;
    opacity: 0.9;
}

.station-tabs {
    background: white;
    padding: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    overflow-x: auto;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    margin: 0 0.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.tab-button:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.tab-button.active {
    background-color: #3730a3;
    color: white;
    box-shadow: 0 2px 4px rgba(55, 48, 163, 0.2);
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    padding-bottom: 40px;
}

.station-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #1f2937;
    text-align: center;
}

.loading, .error {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.error {
    color: #dc2626;
    border-left: 4px solid #dc2626;
}

#retryBtn {
    background-color: #3730a3;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 0.5rem;
    font-size: 0.875rem;
}

#retryBtn:hover {
    background-color: #312e81;
}

.departures-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.departure-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

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

.departure-item:hover {
    background-color: #f9fafb;
}

.departure-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.destination {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.direction-tag {
    background-color: #e5e7eb;
    color: #6b7280;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.direction-tag.to-ny {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.direction-tag.to-nj {
    background-color: #dcfce7;
    color: #16a34a;
}

.line-indicator {
    width: 4px;
    height: 60px;
    border-radius: 2px;
    margin-right: 0.5rem;
}

.departure-time {
    text-align: right;
    min-width: 80px;
}

.time-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.time-unit {
    font-size: 0.875rem;
    color: #6b7280;
    display: block;
}

.no-departures {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
    font-size: 1.1rem;
}

@media (max-width: 768px) {
    header {
        padding: 0.75rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        padding: 1rem 0.5rem;
    }
    
    .departure-item {
        padding: 0.875rem 1rem;
    }
    
    .departure-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .departure-time {
        text-align: right;
        min-width: 60px;
    }
    
    .station-tabs {
        padding: 0.25rem;
    }
    
    .tab-button {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Install Banner Styles */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #3730a3;
    color: white;
    padding: 12px 16px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 12px;
}

.banner-button {
    background-color: white;
    color: #3730a3;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.banner-button:hover {
    background-color: #f3f4f6;
}

.banner-button.dismiss {
    background-color: transparent;
    color: white;
    border: 1px solid white;
}

.banner-button.dismiss:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Install Instructions Styles */
.install-instructions {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 24px;
    max-width: 90%;
    width: 400px;
    z-index: 1001;
}

.instructions-content {
    position: relative;
}

.instructions-content h3 {
    margin: 0 0 16px 0;
    color: #1f2937;
}

.instructions-content p {
    margin: 0 0 12px 0;
    color: #4b5563;
}

.instructions-content ol {
    margin: 0;
    padding-left: 24px;
    color: #4b5563;
}

.instructions-content li {
    margin-bottom: 8px;
}

.instructions-content .icon {
    display: inline-block;
    background-color: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.close-button {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    color: #4b5563;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0;
    border-radius: 4px;
    transition: color 0.2s;
}

.close-button:hover {
    color: #1f2937;
    background-color: #f3f4f6;
}

/* Footer Styles */
.app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.install-link {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 14px;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 8px;
    margin: 8px;
    border-radius: 4px;
}

.install-link:hover {
    color: #3730a3;
    background-color: #f3f4f6;
}

/* Adjust main content when banner is shown */
.install-banner:not([style*="display: none"]) + .app-footer {
    bottom: 60px;
}

.install-banner:not([style*="display: none"]) ~ main {
    padding-bottom: 100px;
}