/**
 * PMW AI Settings Panel Styles
 * 
 * @package ProductManager
 * @since 2.1.0
 */

/* Settings Button - pasuje do pmw-btn-secondary ale z akcentem */
#pmw-ai-settings-btn.pmw-settings-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6) !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-size: 13px !important;
}

#pmw-ai-settings-btn.pmw-settings-btn:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4) !important;
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
}

/* Overlay */
.pmw-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

/* Container */
.pmw-settings-container {
    background: #1c1c1f;
    border: 1px solid #2a2a2e;
    border-radius: 16px;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Header */
.pmw-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #2a2a2e;
}

.pmw-settings-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #fafafa;
}

.pmw-settings-close {
    background: none;
    border: none;
    color: #71717a;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.pmw-settings-close:hover {
    color: #fafafa;
}

/* Tabs */
.pmw-settings-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 24px;
    background: #18181b;
    border-bottom: 1px solid #2a2a2e;
}

.pmw-settings-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #a1a1aa;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pmw-settings-tab:hover {
    background: #232326;
    color: #fafafa;
}

.pmw-settings-tab.active {
    background: #6366f1;
    color: white;
}

/* Content */
.pmw-settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.pmw-settings-loading,
.pmw-settings-error {
    text-align: center;
    padding: 40px;
    color: #a1a1aa;
}

/* Footer */
.pmw-settings-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #2a2a2e;
    background: #18181b;
}

/* Policies Layout */
.pmw-policies-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    min-height: 400px;
}

.pmw-policies-sidebar {
    background: #18181b;
    border-radius: 8px;
    padding: 8px;
}

.pmw-policies-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pmw-policy-tab {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #a1a1aa;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pmw-policy-tab:hover {
    background: #232326;
    color: #fafafa;
}

.pmw-policy-tab.active {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    font-weight: 500;
}

/* Policy Form */
.pmw-policies-content {
    background: #18181b;
    border-radius: 8px;
    padding: 24px;
}

.pmw-policy-form h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #fafafa;
}

.pmw-policy-description {
    margin: 0 0 24px 0;
    color: #71717a;
    font-size: 14px;
}

/* Form Elements */
.pmw-form-row {
    margin-bottom: 20px;
}

.pmw-form-row > label:not(.pmw-checkbox-label) {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #a1a1aa;
    margin-bottom: 8px;
}

.pmw-form-row input[type="text"],
.pmw-form-row input[type="number"],
.pmw-form-row textarea,
.pmw-form-row select {
    width: 100%;
    max-width: 300px;
    padding: 10px 12px;
    background: #232326;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    color: #fafafa;
    font-size: 14px;
    min-height: 42px;
}

.pmw-form-row select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a1a1aa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

.pmw-form-row textarea {
    max-width: 100%;
    resize: vertical;
}

.pmw-form-row input:focus,
.pmw-form-row select:focus,
.pmw-form-row textarea:focus {
    outline: none;
    border-color: #6366f1;
}

.pmw-form-row small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #71717a;
}

.pmw-input-group {
    display: flex;
    gap: 8px;
    max-width: 300px;
}

.pmw-input-group input {
    flex: 1;
}

.pmw-input-group select {
    width: 80px;
    flex-shrink: 0;
    min-height: 42px;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    padding: 8px 12px;
}

/* Checkbox */
.pmw-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #fafafa;
    font-size: 14px;
}

.pmw-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #6366f1;
}

/* Form Actions */
.pmw-form-actions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #2a2a2e;
}

/* Shipping Rules */
.pmw-shipping-settings h3 {
    margin: 0 0 8px 0;
    color: #fafafa;
}

.pmw-shipping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.pmw-info {
    color: #71717a;
    font-size: 13px;
    margin-bottom: 20px;
}

.pmw-shipping-rules-list {
    background: #18181b;
    border-radius: 8px;
    overflow: hidden;
}

.pmw-shipping-rule-header,
.pmw-shipping-rule-row {
    display: grid;
    grid-template-columns: 1fr 150px 150px 100px;
    gap: 16px;
    padding: 12px 16px;
    align-items: center;
}

.pmw-shipping-rule-header {
    background: #111113;
    font-size: 12px;
    font-weight: 600;
    color: #71717a;
    text-transform: uppercase;
}

.pmw-shipping-rule-row {
    border-top: 1px solid #2a2a2e;
    font-size: 14px;
    color: #a1a1aa;
}

.pmw-shipping-rule-row:hover {
    background: #232326;
}

.pmw-rule-domain {
    color: #fafafa;
    font-weight: 500;
}

.pmw-rule-actions {
    display: flex;
    gap: 8px;
}

.pmw-btn-small {
    padding: 6px 10px;
    background: #232326;
    border: 1px solid #3f3f46;
    border-radius: 4px;
    color: #a1a1aa;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pmw-btn-small:hover {
    background: #3f3f46;
    color: #fafafa;
}

.pmw-no-rules {
    padding: 40px;
    text-align: center;
    color: #71717a;
}

/* General Settings */
.pmw-general-settings h3 {
    margin: 0 0 24px 0;
    color: #fafafa;
}

/* Missing Domains Section */
.pmw-missing-domains-section {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.pmw-missing-domains-section h4 {
    margin: 0 0 8px 0;
    color: #f59e0b;
    font-size: 14px;
    font-weight: 600;
}

.pmw-info-small {
    color: #a1a1aa;
    font-size: 12px;
    margin: 0 0 12px 0;
}

.pmw-missing-domains-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.pmw-missing-domain-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.pmw-missing-domain-name {
    flex: 1;
    color: #fafafa;
    font-size: 13px;
    font-weight: 500;
}

.pmw-missing-domain-count {
    color: #71717a;
    font-size: 12px;
}

.pmw-missing-domain-item .pmw-btn-small {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #000;
}

.pmw-missing-domain-item .pmw-btn-small:hover {
    background: #d97706;
    border-color: #d97706;
}

/* Magento Sync Tab */
.pmw-magento-sync-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.pmw-magento-header h3 {
    margin: 0 0 8px 0;
    color: #e0e0e0;
    font-size: 18px;
}

.pmw-magento-header p {
    margin: 0;
    color: #a0a0a0;
    font-size: 14px;
}

.pmw-magento-mappings {
    background: #2a2a2e;
    border-radius: 12px;
    padding: 20px;
}

.pmw-mappings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pmw-mappings-header h4 {
    margin: 0;
    color: #e0e0e0;
    font-size: 16px;
}

.pmw-mappings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pmw-empty-mappings {
    text-align: center;
    padding: 40px 20px;
    color: #a0a0a0;
}

.pmw-mapping-row {
    background: #1c1c1f;
    border: 1px solid #3a3a3e;
    border-radius: 8px;
    padding: 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    transition: all 0.2s ease;
}

.pmw-mapping-row:hover {
    border-color: #6366f1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.pmw-mapping-toggle {
    display: flex;
    align-items: center;
}

/* Toggle Switch */
.pmw-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.pmw-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.pmw-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4a4a4e;
    transition: 0.3s;
    border-radius: 24px;
}

.pmw-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .pmw-slider {
    background-color: #6366f1;
}

input:checked + .pmw-slider:before {
    transform: translateX(20px);
}

.pmw-mapping-fields {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
}

.pmw-mapping-wc,
.pmw-mapping-magento {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pmw-mapping-wc label,
.pmw-mapping-magento label {
    font-size: 11px;
    text-transform: uppercase;
    color: #a0a0a0;
    font-weight: 600;
}

.pmw-mapping-wc strong,
.pmw-mapping-magento strong {
    color: #e0e0e0;
    font-size: 14px;
}

.pmw-field-type {
    font-size: 12px;
    color: #8b5cf6;
    font-weight: 500;
}

.pmw-mapping-arrow {
    color: #6366f1;
    font-size: 20px;
    font-weight: bold;
}

.pmw-mapping-options {
    margin-top: 8px;
    font-size: 12px;
    color: #a0a0a0;
}

.pmw-option-badge {
    display: inline-block;
    background: #3a3a3e;
    color: #e0e0e0;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 4px;
    margin-top: 4px;
    font-size: 11px;
}

.pmw-mapping-actions {
    display: flex;
    gap: 8px;
}

.pmw-btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pmw-btn-icon:hover {
    background: #3a3a3e;
}

.pmw-btn-delete:hover {
    background: #ef4444;
}

.pmw-magento-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #3a3a3e;
}

/* Modal dla dodawania mapowania */
.pmw-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
}

.pmw-modal-container {
    background: #1c1c1f;
    border: 1px solid #2a2a2e;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
}

.pmw-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #3a3a3e;
}

.pmw-modal-header h3 {
    margin: 0;
    color: #e0e0e0;
    font-size: 18px;
}

.pmw-modal-close {
    background: transparent;
    border: none;
    color: #a0a0a0;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pmw-modal-close:hover {
    background: #3a3a3e;
    color: #e0e0e0;
}

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

.pmw-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #3a3a3e;
}

.pmw-field-info {
    margin-top: 12px;
    padding: 12px;
    background: #2a2a2e;
    border-radius: 6px;
    font-size: 13px;
    color: #a0a0a0;
}

.pmw-field-info p {
    margin: 0 0 8px 0;
}

.pmw-field-info ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.pmw-field-info li {
    margin-bottom: 4px;
}

.pmw-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e0e0e0;
    cursor: pointer;
}

.pmw-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .pmw-settings-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .pmw-policies-layout {
        grid-template-columns: 1fr;
    }
    
    .pmw-policies-tabs {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .pmw-shipping-rule-header,
    .pmw-shipping-rule-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .pmw-mapping-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .pmw-mapping-fields {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .pmw-mapping-arrow {
        transform: rotate(90deg);
    }
}
