/**
 * TRS Shipping - Admin Styles
 */

.trs-shipping-admin {
    max-width: 1200px;
}

/* Tabs */
.trs-shipping-tabs .nav-tab-wrapper {
    margin-bottom: 20px;
}

.tab-content {
    display: none;
    background: #fff;
    padding: 20px;
    border: 1px solid #ccd0d4;
    border-top: none;
}

.tab-content.active {
    display: block;
}

/* Forms */
.trs-form .form-table th {
    width: 200px;
}

.trs-form .submit {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trs-form .spinner {
    float: none;
    margin: 0;
}

/* Zones Grid */
.trs-zones-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.trs-zone-card {
    flex: 1 1 280px;
    max-width: 350px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    box-sizing: border-box;
}

.trs-zone-card h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

.trs-zone-card .form-table {
    margin: 0;
    width: 100%;
}

.trs-zone-card .form-table th,
.trs-zone-card .form-table td {
    display: block;
    width: 100%;
    padding: 0;
}

.trs-zone-card .form-table th {
    padding-bottom: 5px;
    font-weight: 600;
}

.trs-zone-card .form-table td {
    padding-bottom: 15px;
}

.trs-zone-card .form-table input[type="number"] {
    width: 100px;
}

.trs-zone-card .form-table textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
}

/* Category Fees */
#category-fees-container {
    margin: 15px 0;
}

.trs-category-fee {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.trs-category-fee select {
    min-width: 200px;
}

.trs-category-fee .trs-remove-category-fee {
    color: #a00;
}

.trs-category-fee .trs-remove-category-fee:hover {
    color: #dc3232;
}

/* Rules */
.trs-rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.trs-rules-header h3 {
    margin: 0;
}

.trs-rules-list {
    margin: 20px 0;
}

.trs-rule {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
}

.trs-rule-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

.trs-rule-drag {
    cursor: move;
    color: #999;
}

.trs-rule-name {
    flex: 1;
    font-weight: 500;
}

.trs-rule-active {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.trs-rule-body {
    display: none;
    padding: 15px;
}

.trs-rule.open .trs-rule-body {
    display: block;
}

.trs-rule.open .trs-rule-toggle .dashicons {
    transform: rotate(180deg);
}

/* Conditions */
.trs-rule-conditions,
.trs-rule-actions {
    margin-bottom: 20px;
}

.trs-rule-conditions h4,
.trs-rule-actions h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #666;
}

.trs-conditions-logic,
.trs-group-logic {
    margin-bottom: 10px;
}

.trs-condition-group {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 10px;
}

.trs-condition-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.trs-group-label {
    font-weight: 500;
    color: #555;
}

.trs-remove-group,
.trs-remove-condition,
.trs-remove-action {
    color: #a00;
    padding: 0;
    margin-left: auto;
}

.trs-remove-group:hover,
.trs-remove-condition:hover,
.trs-remove-action:hover {
    color: #dc3232;
}

.trs-conditions-in-group {
    margin-bottom: 10px;
}

.trs-condition,
.trs-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-bottom: 8px;
}

.trs-condition select,
.trs-action select {
    min-width: 150px;
}

.trs-condition-value-container {
    flex: 1;
    display: flex;
    gap: 8px;
}

.trs-condition-value-container input,
.trs-condition-value-container select {
    min-width: 120px;
}

.trs-action-fields {
    flex: 1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.trs-action-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.trs-action-field label {
    font-size: 11px;
    color: #666;
}

.trs-add-condition,
.trs-add-action {
    font-size: 12px;
}

/* Hint pour les attributs */
.trs-select-attribute-hint {
    color: #999;
    font-style: italic;
    font-size: 12px;
    padding: 4px 8px;
    display: inline-block;
}

/* Select2 adjustments */
.select2-container {
    min-width: 200px;
}

.trs-category-fee .select2-container,
.trs-condition .select2-container {
    min-width: 150px;
}

/* Hiérarchie des catégories dans Select2 */
.trs-category-option {
    display: block;
    padding: 2px 0;
}

.trs-category-option.depth-0 {
    font-weight: 600;
}

.trs-category-option.depth-1,
.trs-category-option.depth-2,
.trs-category-option.depth-3 {
    font-weight: normal;
}

.trs-cat-indent {
    color: transparent;
}

.trs-cat-child-icon {
    color: #999;
    font-size: 11px;
    margin-right: 2px;
}

/* Ajustement pour le dropdown Select2 */
.select2-results__option .trs-category-option {
    line-height: 1.4;
}

.select2-results__option--highlighted .trs-cat-child-icon {
    color: #fff;
}

/* Responsive */
@media screen and (max-width: 960px) {
    .trs-zones-grid {
        grid-template-columns: 1fr;
    }
    
    .trs-condition,
    .trs-action {
        flex-wrap: wrap;
    }
}

/* Notifications */
.trs-notice {
    padding: 10px 15px;
    margin: 10px 0;
    border-left: 4px solid;
    background: #fff;
}

.trs-notice.success {
    border-color: #46b450;
}

.trs-notice.error {
    border-color: #dc3232;
}

/* Loading state */
.trs-loading {
    opacity: 0.6;
    pointer-events: none;
}

.trs-loading .spinner {
    visibility: visible;
}
