/*
 * Admin CSS for Post Order Control
 * One-line file description: Styles cards grid and modal UI with wpuopt- prefix.
 */
.wpuopt-wrap { max-width: 1100px; }
.wpuopt-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 16px; }
.wpuopt-card { border: 1px solid #ddd; border-radius: 8px; background: #fff; display: flex; flex-direction: column; }
.wpuopt-card-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 0; }
.wpuopt-card-head h2 { margin: 0; font-size: 16px; }
.wpuopt-card-body { padding: 8px 12px; }
.wpuopt-card-foot { padding: 12px; border-top: 1px solid #eee; text-align: right; }
.wpuopt-recent { margin: 0; padding-left: 18px; }
.wpuopt-meta { color: #666; }

.wpuopt-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 100000; }
.wpuopt-modal[hidden] { display: none; }
.wpuopt-modal:not([hidden]) { display: flex; }
.wpuopt-modal__dialog { background: #fff; width: min(900px, 95vw); max-height: 90vh; overflow: hidden; border-radius: 10px; display: flex; flex-direction: column; }
.wpuopt-modal__header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #eee; }
.wpuopt-modal__toolbar { display: flex; gap: 12px; align-items: center; padding: 8px 16px; border-bottom: 1px solid #f2f2f2; }
.wpuopt-modal__content { overflow: auto; padding: 0 16px; }
.wpuopt-modal__footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid #eee; }
.wpuopt-modal__close { border: none; background: transparent; font-size: 20px; cursor: pointer; }
.wpuopt-list { margin: 12px 0; padding: 0; list-style: none; }
.wpuopt-list-item { position: relative; display: grid; grid-template-columns: 24px 40px 1fr auto auto; gap: 8px; align-items: center; padding: 8px; border-bottom: 1px solid #f4f4f4; }
.wpuopt-handle { cursor: grab; color: #888; }
.wpuopt-title { font-weight: 600; color: #1e1e1e; }
.wpuopt-status { color: #666; font-size: 12px; }
.wpuopt-date { color: #999; font-size: 12px; }
.wpuopt-spinner { width: 16px; height: 16px; display: none; border: 2px solid #ccc; border-top-color: #0073aa; border-radius: 50%; animation: wpuopt-spin 1s linear infinite; }
/* placeholder style for jQuery UI */
.wpuopt-placeholder { background: #f0f6ff; border: 1px dashed #99c; min-height: 38px; }
@keyframes wpuopt-spin { to { transform: rotate(360deg); } }

body.wpuopt-modal-open { overflow: hidden; }

/* Admin list page styles */
.wpuopt-drag-handle {
    cursor: grab;
    color: #888;
    font-size: 16px;
    line-height: 1;
    padding: 4px;
    display: inline-block;
    user-select: none;
}

.wpuopt-drag-handle:hover {
    color: #0073aa;
}

.wpuopt-drag-handle:active {
    cursor: grabbing;
}

/* Make table rows sortable */
.wp-list-table tbody tr {
    cursor: move;
}

.wp-list-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Placeholder for sortable */
.wpuopt-placeholder {
    background: #f0f6ff;
    border: 1px dashed #99c;
    height: 40px;
    display: block;
}

/* Edit/View links */
.wpuopt-links {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.wpuopt-edit-link,
.wpuopt-view-link {
    font-size: 12px;
    color: #0073aa;
    text-decoration: none;
    padding: 2px 6px;
    border: 1px solid #0073aa;
    border-radius: 3px;
    transition: all 0.2s;
}

.wpuopt-edit-link:hover,
.wpuopt-view-link:hover {
    background: #0073aa;
    color: #fff;
}

/* Toggle Switch Styles */
.wpuopt-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.wpuopt-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.wpuopt-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.wpuopt-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.wpuopt-toggle input:checked + .wpuopt-toggle-slider {
    background-color: #0073aa;
}

.wpuopt-toggle input:focus + .wpuopt-toggle-slider {
    box-shadow: 0 0 1px #0073aa;
}

.wpuopt-toggle input:checked + .wpuopt-toggle-slider:before {
    transform: translateX(26px);
}

/* Toggle Label */
.wpuopt-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.wpuopt-toggle-label label {
    margin: 0;
    font-weight: 500;
}

/* Select2 Customization */
.select2-container {
    width: 100% !important;
    max-width: 400px;
}

/* Fallback select styling when Select2 is not available */
.wpuopt-select-fallback {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    min-height: 32px;
}

.wpuopt-select-fallback:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

.wpuopt-select-fallback[multiple] {
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
}

.select2-container--default .select2-selection--multiple {
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 32px;
    padding: 2px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #0073aa;
    border: 1px solid #0073aa;
    border-radius: 3px;
    color: #fff;
    padding: 4px 20px;
    margin: 2px;
  
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #fff;
    margin-right: 5px;
    padding: 0px 4px;
  border-color: transparent;
  font-size: 18px;
  border-radius: 4px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ff6b6b;
}

.select2-container--default .select2-search--inline .select2-search__field {
    border: none;
    outline: none;
    box-shadow: none;
}

.select2-dropdown {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #0073aa;
}

/* Settings Form Improvements */
.wpuopt-settings-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.wpuopt-settings-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #1e1e1e;
    font-size: 16px;
}

.wpuopt-field-group {
    margin-bottom: 20px;
}

.wpuopt-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #1e1e1e;
}

.wpuopt-field-description {
    color: #666;
    font-size: 13px;
    margin-top: 5px;
    line-height: 1.4;
}

/* Multi-select container */
.wpuopt-multiselect-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background: #fff;
}

.wpuopt-multiselect-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: normal;
    cursor: pointer;
}

.wpuopt-multiselect-container input[type="checkbox"] {
    margin-right: 8px;
}

/* Settings Container */
.wpuopt-settings-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-top: 20px;
}

/* Tab Navigation */
.wpuopt-tabs {
    border-bottom: 1px solid #ddd;
}

.wpuopt-tab-nav {
    display: flex;
    background: #f8f9fa;
    margin: 0;
    padding: 0;
    list-style: none;
}

.wpuopt-tab-button {
    background: transparent;
    border: none;
    padding: 16px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.wpuopt-tab-button:hover {
    background: #fff;
    color: #0073aa;
}

.wpuopt-tab-button.active {
    background: #fff;
    color: #0073aa;
    border-bottom-color: #0073aa;
}

.wpuopt-tab-button:first-child {
    border-top-left-radius: 12px;
}

/* Tab Content */
.wpuopt-tab-content {
    background: #fff;
    min-height: 400px;
}

.wpuopt-tab-panel {
    display: none;
    padding: 30px;
    min-height: 200px;
}

.wpuopt-tab-panel.active {
    display: block;
}


.wpuopt-tab-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.wpuopt-tab-header h2 {
    margin: 0 0 8px 0;
    color: #1e1e1e;
    font-size: 24px;
    font-weight: 600;
}

.wpuopt-tab-description {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* Advanced Sections */
.wpuopt-advanced-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.wpuopt-advanced-section h3 {
    margin: 0 0 20px 0;
    color: #1e1e1e;
    font-size: 18px;
    font-weight: 600;
}

/* Form Improvements */
.wpuopt-settings-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.wpuopt-settings-section h3 {
    margin: 0 0 20px 0;
    color: #1e1e1e;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid #dee2e6;
}

/* Field Groups */
.wpuopt-field-group {
    margin-bottom: 25px;
}

.wpuopt-field-group:last-child {
    margin-bottom: 0;
}

/* Number Input Styling */
.wpuopt-settings-section input[type="number"] {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.wpuopt-settings-section input[type="number"]:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

/* Select Styling */
.wpuopt-settings-section select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}

.wpuopt-settings-section select:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wpuopt-tab-nav {
        flex-direction: column;
    }
    
    .wpuopt-tab-button {
        border-bottom: 1px solid #ddd;
        border-right: none;
    }
    
    .wpuopt-tab-button:last-child {
        border-bottom: none;
    }
    
    .wpuopt-tab-panel {
        padding: 20px;
    }
    
    .wpuopt-settings-section {
        padding: 15px;
    }
}

/* How To Content */
.wpuopt-howto-content {
    max-width: 800px;
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.wpuopt-howto-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.wpuopt-howto-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #1e1e1e;
    font-size: 18px;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px;
}

.wpuopt-howto-section h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #1e1e1e;
    font-size: 16px;
}

.wpuopt-howto-section ol,
.wpuopt-howto-section ul {
    margin-left: 20px;
}

.wpuopt-howto-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.wpuopt-howto-section pre {
    background: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

.wpuopt-howto-section code {
    background: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.wpuopt-howto-section p {
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Responsive How To */
@media (max-width: 768px) {
    .wpuopt-howto-section {
        padding: 15px;
    }
    
    .wpuopt-howto-section pre {
        padding: 10px;
        font-size: 12px;
    }
}


