* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f0f0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, #2196F3 0%, #21CBF3 100%);
    color: white;
    text-align: center;
    padding: 40px 20px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content Layout */
.main-content {
    display: flex;
    padding: 40px;
    gap: 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: calc(100vh - 200px);
}

/* Left Section */
.left-section {
    flex: 2;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1fr;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-align: center;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.header-cell {
    padding: 15px;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.header-cell:last-child {
    border-right: none;
}

.cost-rows {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    overflow: hidden;
}

.cost-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    border-bottom: 1px solid #e8ecf0;
    align-items: center;
}

.cost-row:last-child {
    border-bottom: none;
}

.cost-type {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    padding: 16px 24px;
    font-weight: 500;
    margin-right: 1px;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.amount-input {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    padding: 16px 20px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: #2d3748;
    margin-right: 1px;
    outline: none;
    transition: all 0.3s ease;
    border-radius: 0;
}

.amount-input:focus {
    background: #edf2f7;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.amount-input::placeholder {
    color: #a0aec0;
}

/* Right Section */
.right-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.price-breakdown {
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.breakdown-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 20px;
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #e8ecf0;
    background: #fafbfc;
    transition: background-color 0.2s ease;
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-label {
    color: #555555;
    font-weight: 500;
}

.breakdown-value {
    background: linear-gradient(135deg, #20A0DB 0%, #20A0DB 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    min-width: 90px;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.3);
}

.profit-row {
    align-items: center;
    gap: 10px;
}

.profit-dropdown {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.profit-dropdown:focus {
    border-color: #2E7D32;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.calculate-btn {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
    border: none;
    padding: 16px 36px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 24px rgba(86, 171, 47, 0.3);
    letter-spacing: 0.5px;
}

.calculate-btn:hover {
    background: linear-gradient(135deg, #4c9928 0%, #96d9be 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(86, 171, 47, 0.4);
}

.calculate-btn:active {
    transform: translateY(1px);
}

.selling-price {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 16px;
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.5px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

#sellingPrice {
    color: #ffd700;
    font-size: 1.4rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 800;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        padding: 20px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .table-header,
    .cost-row {
        grid-template-columns: 1fr;
    }
    
    .header-cell {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.2);
    }
    
    .header-cell:last-child {
        border-bottom: none;
    }
    
    .cost-type {
        margin-right: 0;
        margin-bottom: 1px;
    }
    
    .amount-input {
        margin-right: 0;
        margin-bottom: 1px;
    }
    
    .breakdown-row {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .profit-row {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 30px 15px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .cost-type,
    .amount-input {
        padding: 12px 15px;
    }
    
    .breakdown-row {
        padding: 10px 15px;
    }
    
    .calculate-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    .selling-price {
        padding: 12px 20px;
        font-size: 1.1rem;
    }
}

/* Animation for value updates */
.breakdown-value,
#sellingPrice {
    transition: all 0.3s ease;
}

.breakdown-value.updated,
#sellingPrice.updated {
    background: #81C784;
    transform: scale(1.05);
}

/* Error state styles */
.amount-input.error {
    background: #fed2d2;
    border: 2px solid #f56565;
    box-shadow: 0 0 0 3px rgba(141, 221, 13, 0.1);
}

.error-message {
    color: #F44336;
    font-size: 0.9rem;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}