/* Budget Items Specific Styles */

/* Budget Items Container */
.budget-items-container {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Budget Item Form */
.budget-item-form {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
    transition: all 0.3s ease;
}

.budget-item-form:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Budget Item Form Header */
.budget-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.budget-item-title {
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

/* Remove Item Button */
.remove-item {
    background: none;
    border: none;
    color: #e53e3e;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.remove-item:hover {
    background-color: #fed7d7;
    color: #c53030;
}

/* Budget Item Fields */
.budget-item-fields {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    align-items: end;
}

@media (max-width: 768px) {
    .budget-item-fields {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* Form Groups */
.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

/* Add Item Button */
.add-item-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 1rem;
    width: 100%;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.add-item-btn:hover {
    border-color: #4299e1;
    color: #4299e1;
    background-color: #ebf8ff;
}

.add-item-btn i {
    margin-right: 0.5rem;
}

/* Budget Summary */
.budget-summary-item {
    background-color: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.budget-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.budget-summary-row:last-child {
    margin-bottom: 0;
    font-weight: 600;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.5rem;
}

.budget-summary-label {
    color: #4a5568;
}

.budget-summary-amount {
    color: #2d3748;
    font-weight: 500;
}

/* Budget Item Display (Read-only) */
.budget-item-display {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.budget-item-display-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.budget-item-name {
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.budget-item-amount {
    font-weight: 600;
    color: #38a169;
}

.budget-item-description {
    color: #718096;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.budget-item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #a0aec0;
}

/* Budget Item Actions */
.budget-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-edit,
.btn-delete {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit {
    background-color: #4299e1;
    color: white;
}

.btn-edit:hover {
    background-color: #3182ce;
}

.btn-delete {
    background-color: #e53e3e;
    color: white;
}

.btn-delete:hover {
    background-color: #c53030;
}

/* Budget Items List */
.budget-items-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.5rem;
}

.budget-items-list:empty::before {
    content: "No budget items added yet.";
    display: block;
    text-align: center;
    color: #a0aec0;
    padding: 2rem;
    font-style: italic;
}

/* Budget Item Counter */
.budget-item-counter {
    background-color: #4299e1;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Validation States */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: #e53e3e;
}

.form-group.has-error .error-message {
    color: #e53e3e;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-group.has-success input,
.form-group.has-success select,
.form-group.has-success textarea {
    border-color: #38a169;
}

/* Loading States */
.budget-item-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.budget-item-form.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 640px) {
    .budget-item-form {
        padding: 0.75rem;
    }
    
    .budget-item-fields {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .add-item-btn {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .budget-item-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .btn-edit,
    .btn-delete {
        width: 100%;
        text-align: center;
    }
}
