* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

.container {
    background: white;
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 1rem;
}

header h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

header .subtitle {
    font-size: 1.1rem;
    color: #666;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.5;
}

.calculator-section {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.calculator-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.5rem;
    justify-content: center;
}

.tab-btn, .subtab-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 3px;
    background: #f0f0f0;
    color: #333;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-size: 0.9rem;
}

.tab-btn:hover, .subtab-btn:hover {
    background: #e0e0e0;
}

.tab-btn.active, .subtab-btn.active {
    background: #2c3e50;
    color: white;
}

.tab-content, .subtab-content {
    display: none;
    padding: 20px;
    background-color: #fff;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.tab-content.active, .subtab-content.active {
    display: block;
    width: 100%;
}

.tab-content > div, .subtab-content > div {
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

#kirchhoff {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.formula-info {
    background: #f8f9fa;
    padding: 1.2rem;
    border-radius: 3px;
    margin-bottom: 1.2rem;
    border-left: 4px solid #2c3e50;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 1.2rem auto;
}

.formula-info h3 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.formula-info p {
    color: #666;
    margin: 0.3rem 0;
    font-size: 0.9rem;
}

.calculator {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: #2c3e50;
}

.input-with-unit {
    display: flex;
    gap: 10px;
}

.input-with-unit input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.input-with-unit select {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.button-group button {
    flex: 1;
}

.calculator button {
    margin: 5px;
    min-width: 120px;
}

/* Стили для вывода результатов */
.result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #2c3e50;
    font-size: 1.1em;
    line-height: 1.6;
    color: #2c3e50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
}

.result p {
    margin: 0;
    padding: 5px 0;
}

.result strong {
    color: #2c3e50;
    font-weight: 600;
}

.result .unit {
    color: #666;
    font-size: 0.9em;
    margin-left: 5px;
}

.result .value {
    font-weight: bold;
    color: #2c3e50;
}

.result .formula {
    font-family: "Courier New", monospace;
    font-size: 1.2em;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    text-align: center;
}

.result .error {
    color: #e74c3c;
    font-weight: bold;
    padding: 10px;
    background: #fde8e8;
    border-radius: 4px;
    margin: 10px 0;
}

/* Стили для вывода результатов в калькуляторе закона Ома */
.ohm-result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #1abc9c;
}

/* Стили для вывода результатов в калькуляторе мощности */
.power-result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #3498db;
}

/* Стили для вывода результатов в калькуляторе Джоуля-Ленца */
.joule-result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #f39c12;
}

/* Стили для вывода результатов в калькуляторе сопротивления проводника */
.conductor-result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #34495e;
}

/* Стили для вывода результатов в калькуляторе сопротивления при нагреве */
.temperature-result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #9b59b6;
}

/* Адаптивные стили для результатов */
@media (max-width: 768px) {
    .result {
        padding: 15px;
        font-size: 1em;
    }

    .result .formula {
        font-size: 1em;
        padding: 8px;
    }
}

.calculation-examples {
    margin-top: 30px;
}

.calculation-example {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
    width: 100%;
    margin: 1rem auto;
    text-align: left;
    max-width: 800px;
}

.calculation-example h4 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.calculation-example p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.calculation-example ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.calculation-example li {
    margin-bottom: 5px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn, .subtab-btn {
        width: 100%;
    }

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

    .input-with-unit {
        flex-direction: column;
    }

    .input-with-unit select {
        width: 100%;
    }

    button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

.header-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px auto;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

.site-link, .telegram-link, .favorite-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: #2c3e50;
    color: white !important;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    height: 44px;
    box-sizing: border-box;
    border: none;
    cursor: pointer;
    font-size: 1em;
}

.site-link:hover, .telegram-link:hover, .favorite-btn:hover {
    background-color: #34495e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.site-link i, .telegram-link i, .favorite-btn i {
    margin-right: 8px;
    font-size: 1.1em;
    color: white !important;
}

.site-link span, .telegram-link span, .favorite-btn span {
    color: white !important;
}

.site-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #2c3e50;
    color: white !important;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.site-btn:hover {
    background-color: #34495e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.site-btn i {
    font-size: 1.1em;
    color: white !important;
}

.site-btn span {
    color: white !important;
}

.telegram-link {
    background: #0088cc;
    color: white;
}

.telegram-link:hover {
    background: #006699;
}

.favorite-btn {
    background: #f1c40f;
    color: #2c3e50;
    border: none;
    cursor: pointer;
}

.favorite-btn:hover {
    background: #f39c12;
}

.favorite-btn i {
    color: #2c3e50;
}

.social-share {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 1rem auto;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
}

.social-btn:hover {
    transform: scale(1.1);
}

.social-btn i {
    font-size: 1.2rem;
}

.social-btn.vk {
    background: #4C75A3;
}

.social-btn.ok {
    background: #EE8208;
}

.social-btn.twitter {
    background: #1DA1F2;
}

.social-btn.pinterest {
    background: #E60023;
}

.social-btn.mail {
    background: #005FF9;
}

footer {
    width: 100%;
    text-align: center;
    padding: 20px;
    background-color: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    margin-top: 30px;
}

footer .social-share {
    margin-top: 0;
    justify-content: center;
}

.telegram-cta {
    width: 100%;
    text-align: center;
    margin: 1rem auto;
    font-size: 1.1rem;
    color: #333;
}

.telegram-cta a {
    color: #0088cc;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.telegram-cta a:hover {
    color: #006699;
    text-decoration: underline;
}

.author-info {
    font-size: 1em;
    text-align: center;
    margin-top: 20px;
    color: #666;
    line-height: 1.4;
}

.author-info p {
    margin: 0;
    padding: 0;
}

.author-info a {
    color: #666;
    text-decoration: none;
    font-size: 1em;
}

.author-info a:hover {
    text-decoration: underline;
}

.theory {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.theory h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.theory p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.theory ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.theory li {
    margin-bottom: 5px;
}

.formula {
    font-family: "Courier New", monospace;
    font-size: 1.2em;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    margin: 15px 0;
}

.calculation-example {
    width: 100%;
    max-width: 800px;
    margin: 1rem auto;
    text-align: left;
}

.calculation-example h4 {
    color: #2c3e50;
    margin-bottom: 0.8rem;
    font-size: 1rem;
}

.calculation-example p {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.calculation-example ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.calculation-example li {
    margin-bottom: 0.3rem;
}

.site-link {
    text-align: center;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #666;
}

.site-link a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-link a:hover {
    color: #0088cc;
    text-decoration: underline;
}

/* Стили для кнопок */
button {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

button:hover {
    background: linear-gradient(135deg, #357abd, #4a90e2);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

/* Стили для кнопок очистки */
button[onclick*="clearFields"] {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

button[onclick*="clearFields"]:hover {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
}

/* Стили для кнопок расчета */
button[onclick*="calculate"] {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

button[onclick*="calculate"]:hover {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

/* Стили для кнопок в калькуляторе сопротивления при нагреве */
button[onclick*="calculateFinalResistance"],
button[onclick*="calculateFinalTemperature"],
button[onclick*="calculateTCR"],
button[onclick*="calculateInitialResistance"] {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

button[onclick*="calculateFinalResistance"]:hover,
button[onclick*="calculateFinalTemperature"]:hover,
button[onclick*="calculateTCR"]:hover,
button[onclick*="calculateInitialResistance"]:hover {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
}

/* Стили для кнопок в калькуляторе Джоуля-Ленца */
button[onclick*="calculateJoule"] {
    background: linear-gradient(135deg, #f39c12, #d35400);
}

button[onclick*="calculateJoule"]:hover {
    background: linear-gradient(135deg, #d35400, #f39c12);
}

/* Стили для кнопок в калькуляторе мощности */
button[onclick*="calculatePower"] {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

button[onclick*="calculatePower"]:hover {
    background: linear-gradient(135deg, #2980b9, #3498db);
}

/* Стили для кнопок в калькуляторе закона Ома */
button[onclick*="calculateVoltage"],
button[onclick*="calculateCurrent"],
button[onclick*="calculateResistance"] {
    background: linear-gradient(135deg, #1abc9c, #16a085);
}

button[onclick*="calculateVoltage"]:hover,
button[onclick*="calculateCurrent"]:hover,
button[onclick*="calculateResistance"]:hover {
    background: linear-gradient(135deg, #16a085, #1abc9c);
}

/* Стили для кнопок в калькуляторе сопротивления проводника */
button[onclick*="calculateConductorResistance"] {
    background: linear-gradient(135deg, #34495e, #2c3e50);
}

button[onclick*="calculateConductorResistance"]:hover {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

/* Стили для отключенных кнопок */
button:disabled {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Стили для кнопок в навигации */
.nav-tabs button {
    background: none;
    color: #333;
    box-shadow: none;
    padding: 10px 20px;
    border-radius: 0;
    border-bottom: 3px solid transparent;
}

.nav-tabs button:hover {
    background: none;
    color: #4a90e2;
    border-bottom: 3px solid #4a90e2;
}

.nav-tabs button.active {
    color: #4a90e2;
    border-bottom: 3px solid #4a90e2;
    font-weight: bold;
}

.site-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #2c3e50;
    color: white !important;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.site-btn:hover {
    background-color: #34495e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.site-btn i {
    font-size: 1.1em;
    color: white !important;
}

.site-btn span {
    color: white !important;
}

.site-link {
    text-align: center;
    margin: 20px 0;
}

.school-link {
    background-color: #e74c3c;
    color: white;
}

.school-link:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Стили для калькулятора сопротивления проводника */
.calculator#resistance {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.calculator#resistance h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    text-align: center;
}

.calculator#resistance .formula {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

.calculator#resistance .formula p {
    margin: 5px 0;
    color: #2c3e50;
}

.calculator#resistance .formula ul {
    margin: 10px 0;
    padding-left: 20px;
}

.calculator#resistance .formula li {
    margin: 5px 0;
    color: #34495e;
}

.calculator#resistance .input-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.calculator#resistance .input-group label {
    min-width: 200px;
    color: #2c3e50;
    font-weight: 500;
}

.calculator#resistance .input-group input,
.calculator#resistance .input-group select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.calculator#resistance .input-group input:focus,
.calculator#resistance .input-group select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.calculator#resistance .input-group select {
    min-width: 100px;
    background-color: #fff;
}

.calculator#resistance .section-inputs {
    margin-left: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 3px solid #3498db;
}

.calculator#resistance .button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.calculator#resistance .button-group button {
    flex: 1;
    min-width: 150px;
    padding: 12px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.calculator#resistance .button-group button:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.calculator#resistance .result {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #2ecc71;
}

.calculator#resistance .result p {
    margin: 8px 0;
    color: #2c3e50;
    line-height: 1.5;
}

.calculator#resistance .result strong {
    color: #2c3e50;
    font-weight: 600;
}

/* Адаптивность */
@media (max-width: 768px) {
    .calculator#resistance {
        padding: 15px;
    }

    .calculator#resistance .calculator-section {
        padding: 10px;
    }

    .calculator#resistance .input-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .calculator#resistance .input-group label {
        min-width: auto;
        margin-bottom: 5px;
    }

    .calculator#resistance .input-group input,
    .calculator#resistance .input-group select {
        width: 100%;
    }

    .calculator#resistance .button-group {
        flex-direction: column;
    }

    .calculator#resistance .button-group button {
        width: 100%;
    }

    .calculator#resistance .section-inputs {
        margin-left: 10px;
    }
}

#metal-selector {
    width: 200px;
    padding: 5px;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
}

#metal-selector:focus {
    outline: none;
    border-color: #4CAF50;
}

#metal-selector option {
    padding: 5px;
}

.theory, .calculation-example, .formula-info, .calculator {
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
} 
.formula {
    font-size: 1.2em;
    margin: 15px 0;
    padding: 10px;
    background-color: #f5f5f5;
    border-left: 4px solid #4CAF50;
    font-family: 'Courier New', monospace;
}

.fraction {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
}

.fraction .denominator {
    display: block;
    border-top: 1px solid #000;
    padding-top: 2px;
}

.variable {
    font-weight: bold;
    color: #4CAF50;
}

.calculation-example {
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.given, .solution, .answer {
    font-weight: bold;
    margin-top: 10px;
}

.given-list {
    margin-top: 5px;
    margin-bottom: 15px;
}

h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}
.practical-note {
    font-style: italic;
    color: #555;
    border-left: 3px solid #2196F3;
    padding-left: 10px;
    margin-top: 10px;
}

sub {
    vertical-align: sub;
    font-size: smaller;
}
.resistor-group {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
}

.group-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.group-header span {
    margin-right: 10px;
    font-weight: bold;
}

.group-header select {
    margin-right: 10px;
}

.remove-group-btn {
    background: none;
    border: none;
    color: #ff4444;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    margin-left: auto;
}

.add-resistor-btn {
    background: none;
    border: none;
    color: #4285f4;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 14px;
}

.add-resistor-btn:hover {
    text-decoration: underline;
}