/* Main container */
.price-comparison {
    direction: rtl;
    padding: 20px;
    font-family: IRANSans, Tahoma, Arial;
    max-width: 1200px;
    margin: 0 auto;
}

/* Form elements */
.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-row input,
.form-row select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 5px rgba(0,115,170,0.2);
}

.other-competitor {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* Button styles */
.button {
    background-color: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.button:hover {
    background-color: #005177;
}

.button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.button.remove-row {
    background-color: #dc3545;
    margin-left: 5px;
}

.button.update-row {
    background-color: #28a745;
}

/* Table styles */
.comparison-table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    border: 1px solid #dee2e6;
    padding: 12px;
    text-align: right;
}

.comparison-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    white-space: nowrap;
}

.comparison-table tr:hover {
    background-color: #f5f5f5;
}

.comparison-table tr:nth-child(even) {
    background-color: #fafafa;
}

/* Loading state */
.loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Messages */
.error-message {
    background-color: #fff3f4;
    color: #dc3545;
    padding: 10px;
    border-radius: 4px;
    border-right: 4px solid #dc3545;
    margin: 10px 0;
}

.success-message {
    background-color: #f0fff4;
    color: #28a745;
    padding: 10px;
    border-radius: 4px;
    border-right: 4px solid #28a745;
    margin: 10px 0;
}

/* Select2 customization */
.select2-container--default .select2-selection--single {
    height: 38px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    left: 1px;
    right: auto;
    height: 36px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0 8px;
    line-height: 36px;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    padding-right: 8px;
}

.select2-results__option {
    text-align: right;
}

/* Responsive styles */
@media screen and (max-width: 992px) {
    .comparison-table th,
    .comparison-table td {
        min-width: 140px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button {
        width: 100%;
        margin: 5px 0;
    }
}

@media screen and (max-width: 768px) {
    .price-comparison {
        padding: 10px;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 8px;
        font-size: 0.9em;
    }
    
    .button {
        padding: 6px 12px;
        font-size: 0.9em;
    }
}

/* Print styles */
@media print {
    .form-row,
    .form-actions,
    .button {
        display: none;
    }
    
    .comparison-table-wrapper {
        box-shadow: none;
    }
    
    .comparison-table th,
    .comparison-table td {
        border: 1px solid #000;
    }
}