:root {
    --bg-color: #050505;
    /* Deep rich black */
    --card-bg: rgba(20, 20, 22, 0.85);
    /* Dark gray glass */
    --primary-color: #3b82f6;
    /* Solid electric blue */
    --accent-color: #1d4ed8;
    /* Darker blue */
    --text-color: #f8fafc;
    /* White text */
    --text-muted: #94a3b8;
    /* Gray text */
    --border-color: rgba(255, 255, 255, 0.08);
    /* Subtle white borders */
    --glass-border: rgba(255, 255, 255, 0.05);
    --input-bg: #0f0f10;
    /* Almost black inputs */
    --row-hover: rgba(59, 130, 246, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(255, 255, 255, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(255, 255, 255, 0.02) 0px, transparent 50%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 1000px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.6s ease-out;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #ffffff, var(--primary-color));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* --- Input Grid --- */
.input-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.unit-group {
    display: flex;
    gap: 1px;
    background: var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.unit-group input {
    flex: 1;
    /* Allows input to take up remaining space */
    border-radius: 0;
    border: none;
    min-width: 0;
    /* Prevents overflow */
}

.unit-group select {
    width: auto;
    min-width: 80px;
    /* Minimum width to prevent cutoff */
    flex-shrink: 0;
    /* Prevents shrinking */
    border-radius: 0;
    border: none;
    border-left: 1px solid var(--glass-border);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: rgba(255, 255, 255, 0.05);
}

label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    margin-left: 0.25rem;
}

input,
select {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.label-icon {
    width: 16px;
    height: 16px;
    stroke-width: 2.5px;
    color: var(--primary-color);
}

.icon-header {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.header-icon {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.3));
}

.results-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Table Styling */
.table-container {
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1.25rem 1.5rem;
    text-align: left;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--border-color);
}

td {
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.speed-col {
    color: var(--text-color);
    font-weight: 500;
}

.time-col {
    color: var(--primary-color);
    font-weight: 600;
    text-align: right;
}

th:last-child {
    text-align: right;
}

/* Custom Calculation Row Highlight */
tr.custom-row {
    background: rgba(59, 130, 246, 0.1);
}

tr.custom-row:hover {
    background: rgba(59, 130, 246, 0.15);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .input-section {
        grid-template-columns: 1fr;
    }
}