/* --- Base Reset & Variables --- */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 16px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

/* --- Screens & Layout --- */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- Login Screen --- */
#login-screen {
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
}

.login-card {
    background: var(--bg-card);
    padding: 40px 32px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.logo-icon {
    background: var(--primary);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.app-title {
    color: var(--text-main);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 15px;
}

/* --- Language Selectors --- */
.lang-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-body);
    padding: 6px;
    border-radius: 10px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn.active-lang {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Header Language Selector */
.lang-selector-header {
    display: flex;
    gap: 4px;
    margin-right: 12px;
}

.lang-btn-header {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}
.lang-btn-header.active-lang { background: rgba(255,255,255,0.3); }

/* --- Inputs & Buttons --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-field {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border 0.2s, box-shadow 0.2s;
    background: var(--bg-body);
}

.input-field:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

.btn-primary {
    width: 100%;
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

.error-text { color: var(--danger); font-size: 14px; margin-top: 16px; }

/* --- Header --- */
.app-header {
    background-color: #0f172a;
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon-small {
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}

.app-header h1 { font-size: 18px; font-weight: 600; }

.header-actions {
    display: flex;
    align-items: center;
}

.btn-logout {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.1); }

/* --- Main Content --- */
.app-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 60px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.section-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.number-input {
    font-size: 28px;
    text-align: center;
    font-weight: 700;
    padding: 16px;
    color: var(--primary);
}

/* --- Size Selection Buttons --- */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.size-btn {
    padding: 16px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg-body);
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.size-title { font-size: 15px; font-weight: 700; color: var(--text-main); }
.size-desc { font-size: 12px; font-weight: 500; }

.size-btn.active {
    border-color: var(--primary);
    background-color: #eff6ff;
}
.size-btn.active .size-title { color: var(--primary); }

/* --- Options (Dropdown & Switch) --- */
.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

.border-top { border-top: 1px solid var(--border); }

.option-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.select-field {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-body);
    outline: none;
    font-family: inherit;
    color: var(--text-main);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* --- Results Card --- */
.result-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.result-label { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.result-value { font-size: 18px; font-weight: 700; color: var(--text-main); }
.result-value-small { font-size: 15px; font-weight: 600; color: var(--text-main); }

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

.total-row {
    padding-top: 12px;
    align-items: flex-end;
}

.result-label-total { font-size: 16px; font-weight: 700; color: var(--text-main); }
.result-value-total { font-size: 32px; font-weight: 800; color: var(--primary); letter-spacing: -1px; }

.footer-note {
    text-align: center;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 10px;
    line-height: 1.5;
}
