* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: #fcfbf9;
    color: #333333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #d4af37;
}

h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1rem;
    color: #666;
    font-style: italic;
}

main {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 0;
}

#calculator-form {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px 14px;
    align-items: end;
}

.field-endpoint {
    grid-column: span 4;
}

.field-year,
.field-libras,
.field-sueldos,
.field-dineros {
    grid-column: span 2;
}

.field-periodo {
    grid-column: span 4;
}

.field-location {
    grid-column: span 8;
}

.field-filters,
.btn-calculate {
    grid-column: 1 / -1;
}

.form-row {
    display: grid;
    gap: 16px;
}

.compact-grid {
    grid-template-columns: repeat(5, minmax(110px, 1fr));
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
    font-size: 0.95rem;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background-color: #fafafa;
    transition: border-color 0.3s ease;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #8b0000;
    background-color: white;
}

.btn-calculate {
    width: 100%;
    padding: 14px;
    background-color: #8b0000;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    margin-top: 2px;
}

.btn-calculate:hover {
    background-color: #a00000;
}

.btn-calculate:active {
    transform: scale(0.98);
}

.debug-panel {
    margin-top: 18px;
    padding: 12px 14px;
    background: #f7f1e8;
    border: 1px solid #e2d5c1;
    border-radius: 6px;
}

.resolved-period {
    color: #6b1024;
    font-size: 0.95rem;
    font-weight: 600;
}

.resolved-city {
    color: #2f4a63;
    font-size: 0.9rem;
    margin-top: 6px;
    font-weight: 600;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8b0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-card {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(to bottom, #fffef9, #fcf8f2);
    border: 1px solid #e8dcc8;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.result-card h2 {
    color: #8b0000;
    margin-bottom: 15px;
    font-size: 1.3rem;
    border-bottom: 1px solid #e8dcc8;
    padding-bottom: 10px;
}

.math-block {
    background-color: #f5f3ee;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #d4af37;
}

.math-block h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.math-block .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.current-value-block {
    background: linear-gradient(180deg, #f4efe4 0%, #efe6d4 100%);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #8b0000;
}

.current-value-block h3 {
    color: #6b1024;
    font-size: 1rem;
    margin-bottom: 10px;
}

.current-value-block p {
    margin-bottom: 8px;
}

.salary-compare-block {
    background: linear-gradient(180deg, #edf4f8 0%, #e5eef5 100%);
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #2f4a63;
}

.salary-compare-block h3 {
    color: #243746;
    font-size: 1rem;
    margin-bottom: 10px;
}

.salary-compare-block p {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.transport-compare-panel {
    background: linear-gradient(180deg, #f4f1fb 0%, #ebe6f8 100%);
    border-left: 4px solid #4b3f72;
    border-radius: 4px;
    margin-bottom: 20px;
    padding: 8px 12px;
}

.transport-compare-panel summary {
    cursor: pointer;
    color: #2f2850;
    font-size: 1rem;
    font-weight: 700;
    padding: 6px 0;
}

.transport-compare-content {
    margin-top: 8px;
}

.transport-compare-content p {
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.historical-block {
    margin-bottom: 20px;
}

.historical-block h3 {
    color: #8b0000;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.historical-block p {
    margin-bottom: 8px;
    font-size: 1rem;
}

.historical-block p strong {
    color: #6b1024;
}

.historical-block strong {
    color: #2c3e50;
}

.impact-message {
    background-color: #fff8e1;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
    margin-top: 15px;
    font-size: 1.05rem;
}

.impact-message strong {
    color: #6b1024;
}

.source-block {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
    font-size: 0.85rem;
    color: #777;
    font-style: italic;
}

.error {
    margin-top: 20px;
    padding: 15px;
    background-color: #ffe6e6;
    border: 1px solid #ff9999;
    border-radius: 4px;
    color: #cc0000;
    text-align: center;
}

.json-panel {
    margin-top: 30px;
    border: 1px solid #d8ccb7;
    border-radius: 8px;
    overflow: hidden;
    background: #f9f6f0;
}

.json-panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid #e3d9c8;
    background: linear-gradient(180deg, #faf4e9 0%, #f4ede1 100%);
}

.json-panel-header h2 {
    color: #6b1024;
    font-size: 1.05rem;
}

.json-output {
    margin: 0;
    padding: 18px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.92rem;
    line-height: 1.5;
    background: #fffdf9;
    color: #2d2d2d;
}

.hidden {
    display: none;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    main {
        padding: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .result-card {
        padding: 15px;
    }

    #calculator-form {
        grid-template-columns: 1fr 1fr;
    }

    .field-endpoint,
    .field-year,
    .field-libras,
    .field-sueldos,
    .field-dineros,
    .field-periodo,
    .field-location {
        grid-column: span 1;
    }

    .field-filters,
    .btn-calculate {
        grid-column: 1 / -1;
    }

    .compact-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 420px) {
    #calculator-form {
        grid-template-columns: 1fr;
    }

    .field-endpoint,
    .field-year,
    .field-libras,
    .field-sueldos,
    .field-dineros,
    .field-periodo,
    .field-location,
    .field-filters,
    .btn-calculate {
        grid-column: 1;
    }

    .compact-grid {
        grid-template-columns: 1fr;
    }
}
