/* ===== VARIABLES & RESET ===== */
:root {
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.4);
    --text-primary: rgba(30, 30, 40, 0.95);
    --text-secondary: rgba(60, 60, 80, 0.85);
    --accent-glow: rgba(50, 120, 200, 0.8);
    --border-color: #e5e7eb;
    --transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== BASE & BACKGROUND ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: 0.25px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(ellipse at 20% 80%, rgba(120, 180, 255, 0.08), transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(180, 120, 255, 0.08), transparent 50%),
                radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.2), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6, p, div, span, label, td, th, input, button, select, textarea {
    font-family: inherit; color: var(--text-primary);
}

h2 {
    text-align: center; font-weight: 600; font-size: 2rem; margin-bottom: 24px;
    position: relative; display: inline-block; left: 50%; transform: translateX(-50%);
}

h2::after {
    content: ''; position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
    width: 60px; height: 3px; background: var(--accent-glow); border-radius: 2px;
}

/* ===== LAYOUT ===== */
.main-container {
    margin-top: 20px;
}

.tab-buttons {
    display: flex; gap: 8px; background: rgba(255, 255, 255, 0.4);
    padding: 8px; border-radius: 16px; margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-button {
    flex: 1; padding: 10px 12px; background: transparent; border: 0px;
    cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-secondary);
    border-radius: 12px; transition: var(--transition); position: relative; overflow: hidden;
    text-align: center; min-width: 120px;
}

.tab-button:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.5); }

.tab-button.active {
    background: rgba(255, 255, 255, 0.9); color: var(--text-primary);
    font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tab-content { 
    padding: 28px; min-height: 520px; border-radius: 24px; 
}

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.4s ease; }

@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.main { display: flex; gap: 24px; flex-wrap: wrap; }
.input-section, .result-section { flex: 1; min-width: 300px; padding: 24px; }
.result-section { border-left: 1px solid var(--glass-border); display: flex; flex-direction: column; }

/* ===== GLASS COMPONENT ===== */
.glass {
    background: var(--glass-bg); backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border); border-radius: 24px;
    box-shadow: var(--glass-shadow); position: relative; overflow: hidden;
}

/* ===== FORMS & INPUTS ===== */
.input-group {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; margin-bottom: 12px;
}

.input-group label {
    display: inline-flex; align-items: center; gap: 6px;
    font-weight: 500; font-size: 15px; color: var(--text-primary);
    min-width: 85px; text-align: left; line-height: 1;
}

.radio-group {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: 8px; margin-bottom: 5px;
}

.radio-title { font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.radio-options { display: flex; flex-wrap: wrap; gap: 10px 10px; }
.radio-group > label { font-weight: 500; color: var(--text-secondary); }
input[type="radio"] { width: 18px; height: 18px; accent-color: #3b82f6; cursor: pointer; }
label { font-weight: 500; color: var(--text-secondary); }

input[type="number"], input[type="text"] {
    width: 90px; padding: 12px 16px; font-size: 18px;
    background: #ffffff; border: 1px solid var(--border-color);
    border-radius: 12px; color: var(--text-primary); transition: border-color 0.2s ease;
}

input[type="number"]:focus, input[type="text"]:focus {
    outline: none; border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input::placeholder { color: var(--text-secondary); opacity: 0.7; }

/* Stepper Component */
.stepper {
    display: inline-flex; align-items: stretch; background: #ffffff;
    border: 1px solid var(--border-color); border-radius: 10px;
    overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.04); height: 44px;
}

.stepper-btn {
    width: 40px; background: #f8f9fa; border: none; cursor: pointer;
    font-size: 18px; font-weight: 500; color: #333;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s ease; -webkit-tap-highlight-color: transparent; user-select: none;
}

.stepper-btn:active { background: #e9ecef; }

.stepper input {
    width: 64px; border: none; border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color); border-radius: 0;
    text-align: center; font-size: 16px; font-weight: 500; background: #ffffff; padding: 0 8px;
    -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: #fafbfc; }

/* ===== BUTTONS ===== */
.buttons {
    padding: 12px 28px; background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--glass-border); border-radius: 12px;
    cursor: pointer; font-weight: 500; color: var(--text-primary);
    transition: var(--transition); backdrop-filter: blur(10px);
}

.buttons:hover {
    background: #ffffff; transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.buttons:active { transform: translateY(0); }

/* ===== TABLES ===== */
table { width: 100%; max-width: 800px; border-collapse: separate; border-spacing: 0; margin: 24px auto; border-radius: 20px; overflow: hidden; }
th { background: rgba(59, 130, 246, 0.1); color: var(--text-primary); padding: 16px 20px; text-align: left; font-weight: 600; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--glass-border); }
td { padding: 14px 20px; border-bottom: 1px solid rgba(0, 0, 0, 0.05); color: var(--text-secondary); }
tr:last-child td { border-bottom: none; }
tr:hover { background: rgba(255, 255, 255, 0.5); }
tr:nth-child(even) { background: rgba(255, 255, 255, 0.3); }
b { color: rgba(30, 80, 150, 0.95); font-weight: 600; }
i { color: var(--text-secondary); font-style: normal; }

/* ===== UTILITIES ===== */
.disclaimer { color: var(--text-secondary); font-size: 0.8rem; opacity: 0.85; margin-top: 1px; display: block; }
.shadow { box-shadow: var(--glass-shadow); border-radius: 20px; }
hr { height: 1px; background: linear-gradient(90deg, transparent, var(--glass-border), transparent); border: none; margin: 24px 0; opacity: 0.6; }
br { line-height: 0.2; margin: 0; padding: 0; }

/* ===== RESULTS & ERRORS ===== */
#liveResults { font-size: 1.1rem; flex: 1; display: flex; flex-direction: column; justify-content: flex-start; }
#resultsText { line-height: 1.8; }
#resultsText strong { color: var(--text-primary); font-size: 1.1rem; display: block; margin-bottom: 8px; }
#resultsText b { color: #000000; }
#resultsText small { display: block; margin-top: 4px; color: var(--text-secondary); }

/* ===== SCROLLBARS & SELECTION ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.02); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }
::selection { background: rgba(59, 130, 246, 0.3); color: var(--text-primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    body { padding: 16px; }
    .main { flex-direction: column; }
    .result-section { border-left: none; border-top: 1px solid var(--glass-border); padding-top: 24px; }
    .tab-buttons { flex-wrap: wrap; }
    .tab-button { flex: 0 0 calc(50% - 4px); padding: 12px 8px; font-size: 13px; min-width: auto; }
    h2 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .tab-button { flex: 0 0 100%; }
    .input-group, .radio-group { flex-direction: column; align-items: flex-start; }
    label { min-width: auto; margin-bottom: 4px; }
    input[type="number"], input[type="text"] { width: 100%; }
}

/* ===== HAMBURGER MENU ===== */
.hamburger-btn {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 1100;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.hamburger-btn:hover { background: #ffffff; transform: scale(1.05); }

.hamburger-menu {
    position: fixed;
    top: 68px;
    left: 16px;
    z-index: 1099;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 8px;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hamburger-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.menu-links { display: flex; flex-direction: column; gap: 4px; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: background 0.2s ease;
}

.menu-item:hover { background: rgba(59, 130, 246, 0.1); }

.menu-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 4px 4px;
    border: 0px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .hamburger-btn { top: 12px; left: 12px; width: 40px; height: 40px; }
    .hamburger-menu { top: 58px; left: 12px; min-width: 180px; }
}
