/**
 * Dokan Package Presets - Vendor Presets Styles
 * 
 * @package Dokan_Package_Presets
 * @since 1.0.0
 */

/* Container */
.dokan-category-presets-wrap {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    margin: 20px 0;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dokan-category-presets-wrap.loading {
    opacity: 0.6;
    pointer-events: none;
}

.dokan-category-presets-wrap.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Header */
.dokan-category-presets-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e1e1;
}

.dokan-category-presets-header h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.dokan-category-presets-description {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* Preset List */
.dokan-category-presets-list {
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    max-width: 100%;
}

/* Responsive grid for presets */
@media (min-width: 1200px) {
    .dokan-category-presets-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .dokan-category-presets-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .dokan-category-presets-list {
        grid-template-columns: 1fr;
    }
}

.dokan-category-preset-item {
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #fafafa;
    transition: all 0.2s ease;
    padding: 15px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    max-height: 150px;
    cursor: pointer;
    user-select: none;
}

/* Preset name styling */
.preset-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-left: 8px;
}

/* Preset description compact */
.preset-item-description {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
    margin-top: 6px;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dokan-category-preset-item:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.15);
    transform: translateY(-1px);
    background: #f8f9fa;
}

.dokan-category-preset-item.selected {
    border-color: #0073aa;
    background: #f0f8ff;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.15);
}

.dokan-category-preset-item:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 115, 170, 0.2);
}

/* Preset Item Header */
.preset-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.preset-item-radio {
    display: flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
    flex: 1;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.preset-item-radio:hover {
    background-color: rgba(0, 115, 170, 0.05);
}

.preset-item-radio input[type="radio"] {
    margin-right: 10px;
    margin-top: 0;
    transform: scale(1.2);
    cursor: pointer;
}

.preset-item-radio input[type="radio"]:checked {
    accent-color: #0073aa;
}

.preset-item-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}


/* Preset Fields */
.preset-item-fields {
    padding: 0 15px 15px 15px;
    border-top: 1px solid #e1e1e1;
    margin-top: 15px;
    background: #fff;
}

.preset-field-group {
    margin-bottom: 15px;
}

.preset-field-group:last-child {
    margin-bottom: 0;
}

.preset-field-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 13px;
}

.field-editable-indicator {
    color: #0073aa;
    font-size: 11px;
    font-weight: normal;
    margin-left: 5px;
}

.field-readonly-indicator {
    color: #999;
    font-size: 11px;
    font-weight: normal;
    margin-left: 5px;
}

.preset-field-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    line-height: 1.4;
    transition: border-color 0.2s ease;
}

.preset-field-input:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

.preset-field-input[readonly] {
    background-color: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

.preset-field-description {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 12px;
    line-height: 1.3;
}

/* Actions */
.dokan-category-presets-actions {
    text-align: right;
    padding-top: 15px;
    border-top: 1px solid #e1e1e1;
}

.dokan-category-presets-actions .button {
    font-size: 13px;
}

/* No Presets Message */
.no-presets {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 4px;
    margin: 0;
}

/* Preset Description */
.preset-item-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-top: 8px;
    flex-grow: 1;
}

.preset-item-description p {
    margin: 0;
    line-height: 1.4;
}

/* No Category Message */
.no-category-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    background: #f0f8ff;
    border-radius: 4px;
    margin: 0;
    border: 1px dashed #0073aa;
}

.no-category-message p {
    margin: 0;
    font-size: 14px;
}

/* No Presets Message */
.no-presets-message {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    background: #fff3cd;
    border-radius: 4px;
    margin: 0;
    border: 1px solid #ffeaa7;
}

.no-presets-message p {
    margin: 0;
    font-size: 14px;
}

/* Confirmation Modal */
.dokan-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dokan-modal-content {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.dokan-modal-header {
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #e1e1e1;
}

.dokan-modal-header h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
}

.dokan-modal-body {
    padding: 20px;
}

.dokan-modal-body p {
    margin: 0;
    color: #666;
    line-height: 1.5;
}

.dokan-modal-footer {
    padding: 15px 20px 20px 20px;
    text-align: right;
    border-top: 1px solid #e1e1e1;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.dokan-modal-footer .button {
    font-size: 13px;
}

/* Notices */
.dokan-category-presets-wrap .notice {
    margin: 0 0 15px 0;
    padding: 8px 12px;
    border-left: 4px solid;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.dokan-category-presets-wrap .notice.notice-success {
    border-left-color: #46b450;
}

.dokan-category-presets-wrap .notice.notice-error {
    border-left-color: #dc3232;
}

.dokan-category-presets-wrap .notice p {
    margin: 0;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .dokan-category-presets-wrap {
        margin: 15px 0;
        padding: 15px;
    }
    
    .preset-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .preset-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .dokan-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .dokan-modal-footer {
        flex-direction: column;
    }
    
    .dokan-modal-footer .button {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* Integration with Dokan styles */
.dokan-dashboard .dokan-category-presets-wrap {
    margin: 20px 0;
}

.dokan-dashboard .dokan-category-presets-wrap h4 {
    color: #333;
}

/* Loading state improvements */
.dokan-category-presets-wrap.loading .preset-item-fields {
    opacity: 0.5;
}

.dokan-category-presets-wrap.loading .preset-apply-btn {
    opacity: 0.5;
    pointer-events: none;
}

/* Focus states for accessibility */
.preset-item-radio:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 3px;
}

.dokan-category-preset-item:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 6px;
}


/* High contrast mode support */
@media (prefers-contrast: high) {
    .dokan-category-preset-item {
        border-width: 2px;
    }
    
    .dokan-category-preset-item.selected {
        border-color: #000;
        background: #fff;
    }
    
    .preset-field-input:focus {
        border-width: 2px;
    }
}
