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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a5f7a 0%, #159895 100%);
    min-height: 100vh;
    color: #333;
}

.navbar {
    background: linear-gradient(135deg, #1a5f7a 0%, #159895 100%);
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-logo a {
    text-decoration: none;
    color: white;
}

.nav-logo h2 {
    font-size: 1.4em;
    font-weight: 700;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 5px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.calculator-main {
    padding: 10px;
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.calculator-container {
    width: 100%;
    max-width: 1400px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.calc-body {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 10px;
    height: calc(100vh - 90px);
}

.calc-left, .calc-center, .calc-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.page-title {
    margin-bottom: 6px;
}

.page-title h1 {
    color: #1a5f7a;
    font-size: 1em;
    font-weight: 700;
}

.page-title .subtitle {
    color: #888;
    font-size: 0.7em;
}

.calc-left h2, .calc-center h2, .calc-right h2 {
    color: #1a5f7a;
    font-size: 0.85em;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 2px solid #1a5f7a;
}

.input-section {
    background: #f8fafc;
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.input-section h3 {
    color: #1a5f7a;
    font-size: 0.8em;
    margin-bottom: 6px;
    font-weight: 600;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 4px;
}

.input-row:last-child {
    margin-bottom: 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
    color: #555;
    font-size: 0.7em;
}

.input-with-unit {
    display: flex;
    gap: 4px;
    width: 100%;
}

.input-with-unit input {
    flex: 0 0 50%;
    max-width: 50%;
    width: 50%;
    padding: 5px 6px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.8em;
    transition: all 0.3s;
}

.input-with-unit input:focus {
    outline: none;
    border-color: #1a5f7a;
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.unit-selector {
    flex: 0 0 auto;
    padding: 5px 4px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 0.7em;
    background: white;
    color: #555;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 55px;
}

.unit-selector:focus {
    outline: none;
    border-color: #1a5f7a;
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.1);
}

.unit-selector:hover {
    border-color: #1a5f7a;
}

.hint {
    display: block;
    margin-top: 1px;
    font-size: 0.65em;
    color: #888;
    font-style: italic;
}

.calculate-btn {
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, #1a5f7a 0%, #159895 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 6px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 95, 122, 0.4);
}

.calculate-btn:active {
    transform: translateY(0);
}

.results-container {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    align-content: start;
}

.placeholder {
    color: #999;
    text-align: center;
    padding: 40px 0;
    font-style: italic;
    font-size: 0.85em;
}

.result-item {
    padding: 6px 8px;
    background: linear-gradient(135deg, #e8f4f8 0%, #d1e8f0 100%);
    border-radius: 6px;
    border-left: 3px solid #1a5f7a;
}

.result-label {
    font-size: 0.7em;
    color: #666;
    margin-bottom: 2px;
    font-weight: 600;
}

.result-value {
    font-size: 1.1em;
    font-weight: 700;
    color: #1a5f7a;
}

.result-unit {
    font-size: 0.5em;
    color: #888;
    margin-left: 2px;
}

.chart-controls {
    background: #f8fafc;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.chart-control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.chart-control-row:last-child {
    margin-bottom: 0;
}

.chart-control-row label {
    font-size: 0.75em;
    font-weight: 600;
    color: #555;
}

.chart-selector {
    padding: 5px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 0.75em;
    background: white;
    color: #555;
    cursor: pointer;
    flex: 1;
}

.chart-selector:focus {
    outline: none;
    border-color: #1a5f7a;
}

.chart-btn {
    width: 100%;
    padding: 6px;
    background: #1a5f7a;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: all 0.3s;
}

.chart-btn:hover {
    background: #159895;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.formula-toggle {
    padding: 8px 16px;
    background: #f8fafc;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

.toggle-btn {
    background: white;
    border: 2px solid #1a5f7a;
    color: #1a5f7a;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-btn:hover {
    background: #1a5f7a;
    color: white;
}

.formula-section {
    background: #f8fafc;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
}

.formula-section h3 {
    color: #1a5f7a;
    font-size: 0.95em;
    margin-bottom: 10px;
}

.formula-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.formula-box {
    padding: 10px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.formula-box h4 {
    color: #1a5f7a;
    font-size: 0.85em;
    margin-bottom: 6px;
}

.formula {
    background: #e8f4f8;
    padding: 6px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    text-align: center;
    margin-bottom: 6px;
    border: 1px solid #1a5f7a;
    word-break: break-all;
}

.formula-box ul {
    list-style: none;
    padding-left: 0;
}

.formula-box ul li {
    padding: 2px 0;
    color: #555;
    font-size: 0.75em;
}

.formula-box ul li strong {
    color: #1a5f7a;
}

@media (max-width: 1400px) {
    .calc-body {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .calc-right {
        grid-column: span 1;
    }
}

@media (max-width: 1200px) {
    .calc-body {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .calc-right {
        grid-column: span 1;
    }
}

@media (max-width: 1000px) {
    .calc-body {
        grid-template-columns: 1fr;
    }

    .calc-right {
        grid-column: span 1;
    }

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

@media (max-width: 600px) {
    .nav-container {
        flex-direction: column;
        height: auto;
        padding: 10px 0;
        gap: 10px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .calculator-main {
        padding: 10px;
    }

    .page-title h1 {
        font-size: 1.1em;
    }

    .calc-body {
        padding: 12px;
        gap: 12px;
    }

    .input-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .result-value {
        font-size: 1.1em;
    }
}
