@font-face {
    font-family: 'Inter';
    src: url('../../assets/fonts/Inter.ttf') format('truetype');
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --text-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius-sm: 10px;
    --radius: 12px;
    --radius-lg: 16px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --transition: 0.3s ease;
}

.dark-theme {
    --bg-color: #0a1929;
    --card-bg: #112233;
    --text-color: #e9ecef;
    --text-light: #8696a7;
    --border-color: #334b61;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: var(--font);
    background: linear-gradient(135deg, var(--bg-color) 0%, #e2e8f0 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100dvh;
    transition: background var(--transition), color var(--transition);
}
body.dark-theme {
    background: var(--bg-color);
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    width: 100%;
}

.app-header {
    background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 50%, #1a365d 100%);
    color: white;
    padding: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-content h1 {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.menu-button {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}
.menu-button:hover {
    background: rgba(255,255,255,0.25);
}

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.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: rgba(255,255,255,0.25); transition: .3s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background: var(--accent-color); }
input:checked + .slider:before { transform: translateX(20px); }

.app-main {
    flex: 1;
    padding: 1.5rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.calculadora h2 {
    color: var(--primary-color);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-color);
}

.input-group input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.main-button {
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.main-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37,99,235,0.3);
}

.resultado {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
    min-height: 50px;
    display: none;
}

body.dark-theme .resultado {
    background: #1c2e40;
}

.resultado.erro {
    border-left-color: var(--error-color);
    color: var(--error-color);
}

.resultado.sucesso {
    border-left-color: var(--success-color);
}

.resultado p {
    margin: 0.5rem 0;
}

.resultado strong {
    color: var(--primary-color);
}

.hidden {
    display: none;
}

.aviso-pratico {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.sub-navegacao {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.sub-nav-button {
    flex-grow: 1;
    padding: 0.6rem 0.75rem;
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font);
    transition: all var(--transition);
}

.sub-nav-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.sub-nav-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

.painel-conversao {
    padding: 0.75rem 0;
}

.conversor-linha {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.grupo-unidade {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.grupo-unidade label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-light);
}

.conversor-input, .conversor-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color var(--transition);
}

.conversor-input:focus, .conversor-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.conversor-select {
    cursor: pointer;
}

.conversor-resultado {
    font-weight: normal;
    text-align: left;
    color: var(--text-color);
    background: var(--bg-color);
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    min-height: 48px;
}

.igual {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    padding-bottom: 0.75rem;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}
.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.floating-menu {
    position: fixed;
    top: 0;
    left: -350px;
    width: 350px;
    height: 100%;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 25px rgba(0,0,0,0.1);
}
.floating-menu.active {
    left: 0;
}

.menu-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
}
.menu-title i {
    font-size: 1.3rem;
}

.calc-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.calc-item:hover {
    background: rgba(37,99,235,0.06);
}
body.dark-theme .calc-item:hover {
    background: rgba(37,99,235,0.12);
}

.calc-item.active {
    border-left-color: var(--primary-color);
    background: rgba(37,99,235,0.08);
}
body.dark-theme .calc-item.active {
    background: rgba(37,99,235,0.15);
}

.calc-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.1rem;
    flex-shrink: 0;
}
body.dark-theme .calc-item-icon {
    background: #1c2e40;
}

.calc-item-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.2rem;
}

.calc-item-content p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0;
}

@media (max-width: 768px) {
    .app-main, .app-header { padding: 1rem; }
    .floating-menu { width: 100%; left: -100%; }
    .conversor-linha { flex-direction: column; align-items: stretch; gap: 1.25rem; }
    .igual { transform: rotate(90deg); margin: -0.25rem auto; }
}

@media (max-width: 480px) {
    .app-main { padding: 0.75rem; }
    .header-content h1 { font-size: 0.9rem; }
}
