* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.25;
    color: #333;
    background: #F5F5F5;
    min-height: 100vh;
    padding: 1rem;
    overflow-x: hidden;
    position: relative;
}

body:before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(
            circle at 20% 80%,
            rgba(255, 160, 0, 0.15) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 80% 20%,
            rgba(66, 33, 208, 0.15) 0%,
            transparent 50%
        ),
        radial-gradient(
            circle at 40% 40%,
            rgba(107, 70, 255, 0.1) 0%,
            transparent 50%
        ),
        linear-gradient(
            135deg,
            #f8f6ff 0%,
            #fff9f0 50%,
            #f5f2ff 100%
        );
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.calculator-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 1.5rem;
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(20px);
    box-shadow: 
        0 8px 32px rgba(74, 107, 184, 0.1),
        0 2px 12px rgba(255, 185, 80, 0.08);
}

h1 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    color: #4221d0;
}

.product-section {
    background: white;
    padding: 1.25rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.product-info {
    display: flex;
    gap: 1.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.product-image {
    width: 100px;
    height: 100px;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-details {
    flex: 1;
    min-width: 250px;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
}

.product-prices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.price-item {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 0.75rem;
    text-align: center;
}

.price-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.price-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #4221d0;
}

.price-value.purchase {
    color: #ffa000;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    border: 1px solid #FFF;
    background: #FFF;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    padding: 0.65rem;
    outline: none;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 0 15px 0 rgba(74, 107, 184, 0.2);
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #4221d0;
    box-shadow: 0 0 0 3px rgba(66, 33, 208, 0.1);
}

.form-group .input-with-suffix {
    position: relative;
}

.form-group .input-suffix {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-weight: 500;
    font-size: 0.9rem;
}

.input-with-suffix input {
    padding-right: 2.5rem;
}

.form-section {
    background: white;
    padding: 1.25rem;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.form-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #4221d0;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.model-settings h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #4221d0;
}

.results-section {
    display: none;
}

.results-section.active {
    display: block;
}

.results-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 0.85rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.8);
}

.tab-btn.active {
    background: white;
    color: #4221d0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: white;
    padding: 1.25rem;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.result-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.85rem;
    color: #333;
    text-align: center;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    color: #666;
    flex: 1;
}

.result-value {
    font-weight: 600;
    margin-left: 0.5rem;
    text-align: right;
    min-width: 80px;
}

.result-value.positive {
    color: #27ae60;
}

.result-value.negative {
    color: #e74c3c;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    padding: 0.85rem 1.5rem;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.btn-primary {
    background: #4221d0;
    color: white;
}

.btn-primary:hover {
    background: #4e2dde;
}

.btn-primary:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: white;
    color: #4221d0;
    border: 2px solid #4221d0;
    font-weight: 500;
}

.btn-secondary:hover {
    color: #fff;
    background: #4e2dde;
}

#loadProductBtn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.4rem 0.85rem;
    background: #4221d0;
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

#loadProductBtn:hover {
    background: #4e2dde;
}

#loadProductBtn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

.error-message {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: none;
}

.error-message.show {
    display: block;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
    backdrop-filter: blur(5px);
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4221d0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.summary-card {
    background: linear-gradient(135deg, #4221d0, #6b46ff);
    color: white;
    padding: 1.5rem;
    border-radius: 1rem;
    margin-top: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.summary-value {
    font-weight: 700;
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    
    .calculator-container {
        padding: 1rem;
    }
    
    .product-info {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    
    .product-image {
        width: 120px;
        height: 120px;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .results-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        width: 100%;
    }
    
    .result-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .result-value {
        margin-left: 0;
        text-align: left;
        width: 100%;
    }
    
    .summary-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .summary-value {
        width: 100%;
        text-align: right;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .result-card {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
    }
}