* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 2.5em;
}

header p {
    color: #666;
    font-size: 1.1em;
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f5f5f5;
    padding: 10px 15px;
    border-radius: 5px;
}

.language-selector label {
    color: #667eea;
    font-weight: 600;
    margin: 0;
}

.language-selector select {
    padding: 8px;
    border-radius: 5px;
    border: 2px solid #667eea;
    cursor: pointer;
    background: white;
    color: #333;
    font-weight: 500;
}

.language-selector select:hover {
    border-color: #764ba2;
}

nav {
    background: white;
    padding: 0;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow-x: auto;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

nav li {
    border-right: 1px solid #eee;
}

nav li:last-child {
    border-right: none;
}

nav a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #667eea;
    font-weight: 500;
    transition: all 0.3s ease;
}

nav a:hover {
    background: #f5f5f5;
    color: #764ba2;
}

nav a.active {
    background: #667eea;
    color: white;
}

.content {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2em;
}

.calculator-section {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #667eea;
}

.calculator-section h3 {
    color: #764ba2;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    color: #333;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.form-field input,
.form-field select {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 0.95em;
    transition: border-color 0.3s ease;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.form-field input[type="number"] {
    font-family: 'Courier New', monospace;
}

.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

button {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-calculate {
    background: #667eea;
    color: white;
}

.btn-calculate:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-clear {
    background: #e0e0e0;
    color: #333;
}

.btn-clear:hover {
    background: #d0d0d0;
}

.result-box {
    background: #f0f4ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.result-box h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.result-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.result-field:last-child {
    border-bottom: none;
}

.result-label {
    color: #333;
    font-weight: 600;
}

.result-value {
    color: #764ba2;
    font-size: 1.2em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.error-message {
    background: #ffe0e0;
    border: 2px solid #ff6b6b;
    color: #cc0000;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    background: #e0ffe0;
    border: 2px solid #6bff6b;
    color: #00cc00;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    display: none;
}

.success-message.show {
    display: block;
}

footer {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    color: #666;
    margin-top: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.unit-label {
    color: #999;
    font-size: 0.9em;
    font-weight: normal;
}

/* Tablets e dispositivos médios (até 768px) */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    header {
        padding: 20px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }

    header p {
        font-size: 0.95em;
    }

    header > div {
        flex-direction: column;
        align-items: flex-start;
    }

    .language-selector {
        margin-top: 15px;
        width: 100%;
        justify-content: flex-start;
    }

    .content {
        padding: 20px;
    }

    .page h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }

    nav {
        margin-bottom: 20px;
    }

    nav ul {
        flex-direction: column;
    }

    nav li {
        border-right: none;
        border-bottom: 1px solid #eee;
    }

    nav a {
        padding: 12px 15px;
    }

    .calculator-section {
        padding: 20px;
        margin-bottom: 20px;
    }

    .calculator-section h3 {
        font-size: 1.1em;
        margin-bottom: 15px;
    }

    .input-group {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }

    button {
        width: 100%;
        padding: 10px 20px;
        font-size: 0.95em;
    }

    .result-field {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 0;
    }

    .result-label {
        margin-bottom: 8px;
    }

    footer {
        padding: 15px;
        margin-top: 20px;
        font-size: 0.9em;
    }
}

/* Smartphones (até 480px) */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        max-width: 100%;
    }

    header {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
    }

    header h1 {
        font-size: 1.4em;
        margin-bottom: 6px;
    }

    header p {
        font-size: 0.85em;
    }

    .language-selector {
        padding: 8px 10px;
        font-size: 0.85em;
    }

    .language-selector select {
        padding: 6px;
        font-size: 0.85em;
    }

    .content {
        padding: 15px;
        border-radius: 8px;
    }

    .page h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }

    nav {
        margin-bottom: 15px;
        border-radius: 8px;
    }

    nav a {
        padding: 10px 12px;
        font-size: 0.85em;
    }

    .calculator-section {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 6px;
    }

    .calculator-section h3 {
        font-size: 1em;
        margin-bottom: 12px;
    }

    .calculator-section p {
        font-size: 0.85em;
        line-height: 1.4;
    }

    .form-field label {
        font-size: 0.85em;
        margin-bottom: 6px;
    }

    .form-field input,
    .form-field select {
        padding: 10px;
        font-size: 0.85em;
    }

    .unit-label {
        font-size: 0.75em;
    }

    .button-group {
        gap: 8px;
    }

    button {
        padding: 10px 15px;
        font-size: 0.85em;
    }

    .result-box {
        padding: 15px;
        margin-top: 15px;
        border-radius: 6px;
    }

    .result-box h4 {
        font-size: 0.95em;
        margin-bottom: 12px;
    }

    .result-field {
        padding: 8px 0;
        font-size: 0.85em;
    }

    .result-value {
        font-size: 1em;
    }

    .error-message,
    .success-message {
        padding: 12px;
        font-size: 0.85em;
        margin-bottom: 15px;
    }

    footer {
        padding: 12px;
        margin-top: 15px;
        border-radius: 8px;
        font-size: 0.8em;
    }
}

/* Ultra-pequenos (até 360px) */
@media (max-width: 360px) {
    header h1 {
        font-size: 1.1em;
    }

    header p {
        font-size: 0.8em;
    }

    .page h2 {
        font-size: 1.1em;
    }

    nav a {
        padding: 8px 10px;
        font-size: 0.75em;
    }

    button {
        padding: 8px 12px;
        font-size: 0.8em;
    }

    .calculator-section {
        padding: 12px;
    }

    .calculator-section h3 {
        font-size: 0.95em;
    }

    .form-field label {
        font-size: 0.8em;
    }
}

/* Landscape mode (até 768px de altura) */
@media (max-height: 768px) and (orientation: landscape) {
    header {
        padding: 15px 30px;
        margin-bottom: 15px;
    }

    header h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }

    header p {
        font-size: 0.9em;
    }

    .content {
        padding: 20px;
    }

    .page h2 {
        font-size: 1.3em;
        margin-bottom: 15px;
    }

    .calculator-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    .calculator-section h3 {
        font-size: 1em;
        margin-bottom: 10px;
    }

    nav a {
        padding: 10px 15px;
    }

    button {
        padding: 8px 20px;
    }
}

/* Mobile landscape pequeno */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 10px 20px;
        margin-bottom: 10px;
    }

    header h1 {
        font-size: 1.2em;
        margin-bottom: 2px;
    }

    .language-selector {
        padding: 6px 10px;
    }

    .content {
        padding: 15px;
    }

    .page h2 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }

    .calculator-section {
        padding: 12px;
        margin-bottom: 12px;
    }

    .form-field input,
    .form-field select {
        padding: 8px;
        font-size: 0.8em;
    }

    button {
        padding: 6px 15px;
        font-size: 0.8em;
    }

    footer {
        padding: 10px;
        font-size: 0.75em;
        margin-top: 10px;
    }
}

/* Melhorias de acessibilidade e contraste */
@media (prefers-contrast: more) {
    nav a:hover {
        background: #667eea;
        color: white;
    }

    button:focus {
        outline: 3px solid #764ba2;
        outline-offset: 2px;
    }

    .form-field input:focus,
    .form-field select:focus {
        outline: 3px solid #667eea;
        outline-offset: 2px;
    }
}

/* Modo reduzido de movimento */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
