Files
flight-lookup/style.css
T

815 lines
15 KiB
CSS

/* ============ Theme variables ============ */
:root {
--bg: #0f172a;
--bg-soft: #131c31;
--card: rgba(30, 41, 59, 0.72);
--card-solid: #1e293b;
--text: #e2e8f0;
--muted: #94a3b8;
--accent: #38bdf8;
--accent-2: #818cf8;
--accent-hover: #0ea5e9;
--error: #f87171;
--success: #4ade80;
--warning: #fbbf24;
--border: #334155;
--border-soft: rgba(148, 163, 184, 0.18);
--grid-line: rgba(148, 163, 184, 0.06);
--glow-1: rgba(56, 189, 248, 0.16);
--glow-2: rgba(129, 140, 248, 0.14);
--shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
--map-bg: #0c1425;
--map-grid: #1e293b;
--map-text: #e2e8f0;
--input-bg: rgba(15, 23, 42, 0.6);
}
[data-theme="light"] {
--bg: #f1f5f9;
--bg-soft: #e8eef5;
--card: rgba(255, 255, 255, 0.82);
--card-solid: #ffffff;
--text: #0f172a;
--muted: #64748b;
--accent: #0284c7;
--accent-2: #6366f1;
--accent-hover: #0369a1;
--error: #dc2626;
--success: #16a34a;
--warning: #d97706;
--border: #cbd5e1;
--border-soft: rgba(100, 116, 139, 0.22);
--grid-line: rgba(100, 116, 139, 0.08);
--glow-1: rgba(2, 132, 199, 0.12);
--glow-2: rgba(99, 102, 241, 0.1);
--shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
--map-bg: #e2e8f0;
--map-grid: #cbd5e1;
--map-text: #0f172a;
--input-bg: rgba(255, 255, 255, 0.7);
}
/* ============ Base ============ */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
[hidden] {
display: none !important;
}
html {
scroll-behavior: smooth;
}
body {
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
background: var(--bg);
color: var(--text);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 1.5rem 1rem;
position: relative;
overflow-x: hidden;
transition: background 0.3s ease, color 0.3s ease;
}
/* ============ Background decoration ============ */
.bg-grid {
position: fixed;
inset: 0;
background-image:
linear-gradient(var(--grid-line) 1px, transparent 1px),
linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
background-size: 48px 48px;
pointer-events: none;
z-index: 0;
}
.bg-glow {
position: fixed;
width: 520px;
height: 520px;
border-radius: 50%;
filter: blur(90px);
pointer-events: none;
z-index: 0;
animation: drift 18s ease-in-out infinite alternate;
}
.bg-glow-1 {
top: -160px;
left: -120px;
background: var(--glow-1);
}
.bg-glow-2 {
bottom: -180px;
right: -140px;
background: var(--glow-2);
animation-delay: -9s;
}
@keyframes drift {
from { transform: translate(0, 0) scale(1); }
to { transform: translate(40px, 30px) scale(1.08); }
}
/* ============ Header ============ */
.site-header {
width: 100%;
max-width: 620px;
margin-bottom: 1.25rem;
position: relative;
z-index: 1;
}
.header-inner {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 1rem;
}
.brand {
display: flex;
align-items: center;
gap: 0.85rem;
}
.brand-icon {
width: 46px;
height: 46px;
border-radius: 12px;
display: grid;
place-items: center;
background: linear-gradient(135deg, var(--accent), var(--accent-2));
color: #fff;
box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
flex-shrink: 0;
}
.brand-icon svg {
width: 26px;
height: 26px;
}
h1 {
font-size: 1.45rem;
font-weight: 700;
letter-spacing: -0.01em;
line-height: 1.1;
}
.subtitle {
color: var(--muted);
font-size: 0.88rem;
margin-top: 0.2rem;
}
.header-controls {
display: flex;
align-items: center;
gap: 0.5rem;
}
.lang-select select {
background: var(--input-bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.4rem 0.5rem;
font-size: 0.85rem;
cursor: pointer;
}
.lang-select select:focus {
outline: none;
border-color: var(--accent);
}
.theme-toggle {
width: 38px;
height: 38px;
border-radius: 10px;
border: 1px solid var(--border);
background: var(--input-bg);
color: var(--text);
cursor: pointer;
display: grid;
place-items: center;
transition: border-color 0.2s ease, transform 0.15s ease;
}
.theme-toggle:hover {
border-color: var(--accent);
transform: translateY(-1px);
}
.theme-toggle svg {
width: 18px;
height: 18px;
}
/* Show sun in dark mode, moon in light mode */
[data-theme="dark"] .icon-sun,
:root:not([data-theme]) .icon-sun { display: block; }
[data-theme="dark"] .icon-moon,
:root:not([data-theme]) .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }
/* ============ Container / card ============ */
.container {
background: var(--card);
border: 1px solid var(--border-soft);
border-radius: 18px;
padding: 1.75rem;
width: 100%;
max-width: 620px;
box-shadow: var(--shadow);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
position: relative;
z-index: 1;
}
/* ============ Form ============ */
.lookup-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.field {
display: flex;
flex-direction: column;
gap: 0.35rem;
position: relative;
}
label {
font-size: 0.82rem;
color: var(--muted);
font-weight: 500;
}
.input-wrap {
position: relative;
}
input[type="text"] {
background: var(--input-bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: 10px;
padding: 0.65rem 0.8rem;
font-size: 1rem;
width: 100%;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="text"]::placeholder {
color: var(--muted);
opacity: 0.7;
}
input[type="text"]:focus {
outline: none;
border-color: var(--accent);
box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
/* ============ Primary button ============ */
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
background: linear-gradient(135deg, var(--accent), var(--accent-2));
color: #fff;
border: none;
border-radius: 10px;
padding: 0.75rem 1rem;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
margin-top: 0.25rem;
transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
box-shadow: 0 8px 22px rgba(56, 189, 248, 0.28);
}
.btn-primary:hover {
transform: translateY(-1px);
filter: brightness(1.05);
box-shadow: 0 12px 28px rgba(56, 189, 248, 0.38);
}
.btn-primary:active {
transform: translateY(0);
}
.btn-primary:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.btn-icon {
width: 18px;
height: 18px;
}
/* ============ Suggestions dropdown ============ */
.suggestions {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: var(--card-solid);
border: 1px solid var(--border);
border-radius: 10px;
margin-top: 0.3rem;
z-index: 20;
max-height: 220px;
overflow-y: auto;
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.suggestions.hidden {
display: none;
}
.suggestion {
padding: 0.55rem 0.8rem;
cursor: pointer;
font-size: 0.9rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.suggestion:hover,
.suggestion.active {
background: var(--border-soft);
}
.suggestion .code {
color: var(--accent);
font-weight: 700;
min-width: 2.2rem;
}
/* ============ Result card ============ */
.result {
margin-top: 1.5rem;
padding: 1.25rem;
border-radius: 14px;
border: 1px solid var(--border-soft);
background: var(--input-bg);
animation: fadeUp 0.35s ease;
}
@keyframes fadeUp {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
.result.hidden {
display: none;
}
.result.error {
border-color: var(--error);
color: var(--error);
background: rgba(248, 113, 113, 0.08);
font-size: 0.95rem;
line-height: 1.5;
}
/* Loading state */
.result.loading {
display: flex;
align-items: center;
gap: 0.75rem;
color: var(--muted);
font-size: 0.95rem;
}
.spinner {
width: 20px;
height: 20px;
border: 2.5px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.7s linear infinite;
flex-shrink: 0;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.flight-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 1.1rem;
flex-wrap: wrap;
gap: 0.5rem;
}
.flight-label {
font-weight: 700;
font-size: 1.08rem;
letter-spacing: -0.01em;
}
.status-badge {
font-size: 0.72rem;
font-weight: 700;
padding: 0.3rem 0.7rem;
border-radius: 999px;
text-transform: uppercase;
letter-spacing: 0.04em;
display: inline-flex;
align-items: center;
gap: 0.4rem;
}
.status-badge::before {
content: "";
width: 7px;
height: 7px;
border-radius: 50%;
background: currentColor;
animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.45; transform: scale(0.8); }
}
.status-badge.on-time {
background: rgba(74, 222, 128, 0.15);
color: var(--success);
}
.status-badge.delayed {
background: rgba(251, 191, 36, 0.15);
color: var(--warning);
}
.status-badge.cancelled {
background: rgba(248, 113, 113, 0.15);
color: var(--error);
}
.status-badge.airborne {
background: rgba(74, 222, 128, 0.15);
color: var(--success);
}
.status-badge.onGround {
background: rgba(148, 163, 184, 0.18);
color: var(--muted);
}
/* Live / mock pills */
.live-pill,
.mock-pill {
font-size: 0.62rem;
font-weight: 800;
letter-spacing: 0.08em;
padding: 0.22rem 0.55rem;
border-radius: 999px;
text-transform: uppercase;
}
.live-pill {
background: linear-gradient(135deg, var(--accent), var(--accent-2));
color: #fff;
box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}
.mock-pill {
background: rgba(148, 163, 184, 0.15);
color: var(--muted);
border: 1px solid var(--border);
}
/* ============ Live stats ============ */
.live-stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0.6rem;
margin: 0.4rem 0 0.2rem;
}
.stat {
background: var(--surface-2);
border: 1px solid var(--border);
border-radius: 12px;
padding: 0.6rem 0.7rem;
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.stat-k {
font-size: 0.62rem;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--muted);
font-weight: 600;
}
.stat-v {
font-size: 0.95rem;
font-weight: 700;
color: var(--text);
font-variant-numeric: tabular-nums;
}
/* ============ Route ============ */
.route {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 0.5rem;
}
.airport {
text-align: center;
min-width: 84px;
}
.airport .code {
font-size: 1.6rem;
font-weight: 800;
background: linear-gradient(135deg, var(--accent), var(--accent-2));
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
line-height: 1.1;
}
.airport .city {
color: var(--muted);
font-size: 0.8rem;
margin-top: 0.2rem;
}
.airport .time {
font-size: 1.05rem;
font-weight: 600;
margin-top: 0.45rem;
}
.airport .tz {
color: var(--muted);
font-size: 0.72rem;
margin-top: 0.15rem;
}
.route-mid {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.3rem;
padding: 0 0.4rem;
}
.route-line {
width: 100%;
height: 2px;
background: linear-gradient(90deg, var(--accent), var(--accent-2));
border-radius: 2px;
position: relative;
}
.route-line::before,
.route-line::after {
content: "";
position: absolute;
top: 50%;
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--accent);
transform: translateY(-50%);
}
.route-line::before { left: 0; }
.route-line::after { right: 0; background: var(--accent-2); }
.route-duration {
color: var(--muted);
font-size: 0.78rem;
font-weight: 500;
}
/* ============ Map ============ */
.map-wrap {
margin-top: 1.25rem;
border-radius: 12px;
overflow: hidden;
border: 1px solid var(--border-soft);
background: var(--map-bg);
}
.map-wrap svg {
display: block;
width: 100%;
height: auto;
}
.map-grid-line {
stroke: var(--map-grid);
stroke-width: 1;
}
.map-route {
fill: none;
stroke: url(#routeGradient);
stroke-width: 2.5;
stroke-linecap: round;
}
.map-point {
fill: var(--accent);
}
.map-point-arr {
fill: var(--accent-2);
}
.map-label {
fill: var(--map-text);
font-size: 11px;
font-weight: 600;
font-family: system-ui, sans-serif;
}
.map-sublabel {
fill: var(--muted);
font-size: 9px;
font-family: system-ui, sans-serif;
}
.map-live-dot {
fill: var(--accent);
stroke: #fff;
stroke-width: 2;
}
.map-live-pulse {
fill: var(--accent);
opacity: 0.35;
transform-origin: center;
transform-box: fill-box;
animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
0% { transform: scale(0.6); opacity: 0.5; }
100% { transform: scale(2.4); opacity: 0; }
}
.map-heading {
stroke: var(--accent-2);
stroke-width: 2.5;
stroke-linecap: round;
}
/* ============ Share / meta row ============ */
.result-meta {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 1.1rem;
padding-top: 1rem;
border-top: 1px solid var(--border-soft);
flex-wrap: wrap;
gap: 0.5rem;
}
.share-link {
color: var(--accent);
font-size: 0.85rem;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 0.35rem;
font-weight: 500;
}
.share-link:hover {
text-decoration: underline;
}
.share-link svg {
width: 14px;
height: 14px;
}
.airline-name {
color: var(--muted);
font-size: 0.85rem;
}
/* ============ History ============ */
.history-section {
margin-top: 1.5rem;
position: relative;
z-index: 1;
width: 100%;
max-width: 620px;
}
.history-section h2 {
font-size: 0.85rem;
color: var(--muted);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 0.6rem;
}
.history-list {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
list-style: none;
}
.history-item {
background: var(--card);
border: 1px solid var(--border-soft);
border-radius: 999px;
padding: 0.35rem 0.85rem;
font-size: 0.85rem;
font-weight: 600;
color: var(--text);
cursor: pointer;
transition: border-color 0.2s ease, transform 0.15s ease;
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
}
.history-item:hover {
border-color: var(--accent);
transform: translateY(-1px);
}
.history-item .h-code {
color: var(--accent);
}
.history-empty {
color: var(--muted);
font-size: 0.85rem;
}
/* ============ Footer ============ */
.site-footer {
margin-top: 1.5rem;
color: var(--muted);
font-size: 0.78rem;
position: relative;
z-index: 1;
text-align: center;
}
/* ============ Responsive ============ */
@media (max-width: 480px) {
.container {
padding: 1.25rem;
}
.airport .code {
font-size: 1.3rem;
}
.airport .time {
font-size: 0.95rem;
}
.header-inner {
flex-direction: column;
align-items: flex-start;
}
.header-controls {
width: 100%;
justify-content: space-between;
}
}