* {
    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;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.calculator {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.input-section {
    padding: 40px;
    background: #f8f9fa;
}

.input-section h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.main-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

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

.input-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #34495e;
    font-size: 1.1rem;
}

.input-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cost-item,
.profit-item {
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .input-section {
        padding: 10px;
    }
}

.cost-item:hover,
.profit-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.cost-item label,
.profit-item label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #34495e;
}

.cost-item input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.cost-item input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.profit-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 768px) {
    .profit-inputs {
        flex-direction: column;
        align-items: flex-start;
    }
}

.profit-inputs input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.profit-inputs input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.profit-inputs select {
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.profit-inputs select:focus {
    outline: none;
    border-color: #667eea;
}

.tariff-section {
    margin-bottom: 30px;
}

.tariff-section h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.4rem;
}

.tariff-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr 1fr 1fr;
}

.tariff-item {
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.tariff-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.tariff-item label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #34495e;
}

.range-inputs {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.range-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.range-label {
    color: #7f8c8d;
    font-weight: 500;
    font-size: 0.9rem;
}

.tariff-item input[type="number"] {
    width: 100px;
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
}

.tariff-item input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tariff-item input[readonly] {
    background-color: #f8f9fa;
    color: #7f8c8d;
    cursor: not-allowed;
}

.tariff-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tariff-label {
    color: #7f8c8d;
    font-weight: 500;
    font-size: 0.9rem;
}

.currency {
    color: #7f8c8d;
    font-weight: 600;
}

.infinity {
    font-size: 1.5rem;
    color: #7f8c8d;
    font-weight: 600;
    margin: 0 10px;
}

.auto-range {
    color: #667eea;
    font-weight: 600;
    font-size: 1rem;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    min-width: 60px;
    text-align: center;
}

.calculate-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
}

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

.results-section {
    padding: 40px;
    background: white;
}

.results-section h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 1.8rem;
    text-align: center;
}

.result-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.summary-item {
    text-align: center;
}

.summary-item .label {
    display: block;
    font-weight: 600;
    color: #7f8c8d;
    margin-bottom: 10px;
    font-size: 1rem;
}

.summary-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.total-cost {
    color: #27ae60 !important;
    font-size: 2rem !important;
}

.payback-time {
    color: #e67e22 !important;
    font-size: 1.8rem !important;
}

.net-profit {
    color: #27ae60 !important;
    font-size: 1.8rem !important;
}

.detailed-results h3 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.4rem;
    text-align: center;
}

.grid-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-item {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border-left: 5px solid #667eea;
    transition: all 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.grid-name {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.2rem;
}

.grid-range {
    color: #7f8c8d;
    font-size: 0.9rem;
    background: #e9ecef;
    padding: 5px 10px;
    border-radius: 20px;
}

.grid-details {
    display: grid;
    gap: 10px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.detail-row span:first-child {
    color: #7f8c8d;
    font-weight: 500;
}

.detail-row span:last-child {
    font-weight: 700;
    color: #2c3e50;
}

footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .input-section,
    .results-section {
        padding: 25px;
    }
    
    .tariff-grid {
        grid-template-columns: 1fr;
        gap: 3px;
    }
    
    .main-inputs {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .result-summary {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    
    .grid-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .tariff-item input[type="number"] {
        padding: 3px 5px;
        width: 80px;
    }
    
    
    .tariff-input {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .grid-results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .input-section,
    .results-section {
        padding: 20px;
    }
    
    .calculate-btn {
        padding: 15px;
        font-size: 1.1rem;
    }
}
