/**
 * Additional styles for Pictaffil WordPress Plugin Admin
 */

/* Active/Inactive Toggle for Products */
.pictaffil-toggle-active {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    z-index: 5;
}

.pictaffil-toggle-active.active {
    background-color: #4CAF50;
    color: white;
}

.pictaffil-toggle-active.inactive {
    background-color: #f44336;
    color: white;
}

/* Visibility Options */
.pictaffil-visibility-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.pictaffil-visibility-option {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.pictaffil-visibility-option.selected {
    background: #f0f0f0;
    border-color: #aaa;
    font-weight: bold;
}

/* Improved Position and Style Options */
.pictaffil-saved-products-options {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
    border: 1px solid #eee;
}

.pictaffil-option-label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.pictaffil-position-options,
.pictaffil-card-style-options,
.pictaffil-visibility-options {
    margin-bottom: 15px;
}

.pictaffil-position-option,
.pictaffil-card-style-option,
.pictaffil-visibility-option {
    display: inline-block;
    padding: 6px 12px;
    margin-right: 5px;
    margin-bottom: 5px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pictaffil-position-option:hover,
.pictaffil-card-style-option:hover,
.pictaffil-visibility-option:hover {
    background-color: #f0f0f0;
    border-color: #ccc;
}

.pictaffil-position-option.selected,
.pictaffil-card-style-option.selected,
.pictaffil-visibility-option.selected {
    background-color: #4f46e5;
    color: white;
    border-color: #4f46e5;
    font-weight: normal;
}

/* Saved Products Section */
.pictaffil-saved-products-section {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pictaffil-saved-products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.pictaffil-saved-products-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.pictaffil-saved-products-actions {
    display: flex;
    gap: 10px;
}

.pictaffil-saved-products-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

/* Add this to editor-panel.php */
.pictaffil-editor-panel .pictaffil-saved-products-section {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #eee;
}


/* Copy Icon Styles */
.pictaffil-copy-product-container {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 10;
}

.pictaffil-copy-product {
    width: 24px;
    height: 24px;
    padding: 0;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #333;
    transition: all 0.2s ease;
}

.pictaffil-copy-product:hover {
    background: #f0f0f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pictaffil-copy-icon {
    font-size: 12px;
    line-height: 1;
}

.pictaffil-copy-options {
    position: absolute;
    top: 28px;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 100;
    width: 120px;
}

.pictaffil-copy-option {
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pictaffil-copy-option:hover {
    background: #f5f5f5;
}

.pictaffil-copy-option:not(:last-child) {
    border-bottom: 1px solid #eee;
}

/* Remove duplicate modal styles and improve the modal popup */
.pictaffil-modal {
    position: fixed;
    z-index: 100000; /* Higher z-index to ensure it appears on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    overflow: auto;
    display: none; /* Hidden by default */
}

.pictaffil-modal-content {
    background-color: #fff;
    margin: 50px auto;
    padding: 25px;
    border: 1px solid #ddd;
    width: 80%;
    max-width: 600px;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
    animation: pictaffil-modal-fadeIn 0.3s ease;
}

@keyframes pictaffil-modal-fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.pictaffil-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.pictaffil-modal-close:hover,
.pictaffil-modal-close:focus {
    color: #333;
    text-decoration: none;
}

/* Prevent body scrolling when modal is open */
body.pictaffil-modal-open {
    overflow: hidden;
}

.pictaffil-settings-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.pictaffil-settings-section:last-child {
    border-bottom: none;
}

.pictaffil-settings-section h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

.pictaffil-setting-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.pictaffil-setting-row label {
    min-width: 150px;
    font-weight: 500;
}

.pictaffil-setting-row input[type="text"],
.pictaffil-setting-row input[type="number"],
.pictaffil-setting-row select {
    width: 200px;
}

.pictaffil-setting-row input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 0;
}

.pictaffil-modal-actions {
    margin-top: 20px;
    text-align: right;
}

#pictaffil-reset-settings {
    margin-right: 10px;
}

/* Tab Interface for Saved Products */
.pictaffil-saved-products-tabs {
    margin-top: 15px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 15px;
}

.pictaffil-tab-content {
    display: none;
}

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

.pictaffil-tab-trigger {
    position: relative;
}

.pictaffil-tab-trigger.active {
    background-color: #4f46e5;
    color: #fff;
    border-color: #4338ca;
}

.pictaffil-tab-button {
    position: relative;
}

.pictaffil-tab-button.active {
    background-color: #4f46e5 !important;
    color: #fff !important;
    border-color: #4338ca !important;
}

.pictaffil-carousel-settings {
    padding: 10px 0;
}

.pictaffil-settings-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.pictaffil-settings-group:last-child {
    border-bottom: none;
    margin-bottom: 10px;
}

.pictaffil-settings-group h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.pictaffil-setting-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.pictaffil-setting-row label {
    min-width: 150px;
    font-weight: 500;
}

.pictaffil-options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pictaffil-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* Improved settings organization */
.pictaffil-settings-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.pictaffil-settings-section {
    background-color: #fff;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 5px;
}

.pictaffil-settings-heading {
    font-size: 14px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
    color: #333;
}

.pictaffil-setting-field {
    margin-bottom: 12px;
}

.pictaffil-setting-field:last-child {
    margin-bottom: 0;
}

.pictaffil-setting-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.pictaffil-checkbox-label {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    font-size: 14px;
    cursor: pointer;
}

.pictaffil-checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    min-width: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.pictaffil-checkbox-label span {
    flex: 1;
    line-height: 1.4;
    font-size: 14px;
}

.pictaffil-settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Options styling */
.pictaffil-options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.pictaffil-position-option,
.pictaffil-card-style-option,
.pictaffil-visibility-option {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.pictaffil-position-option:hover,
.pictaffil-card-style-option:hover,
.pictaffil-visibility-option:hover {
    background: #f0f0f0;
}

.pictaffil-position-option.selected,
.pictaffil-card-style-option.selected,
.pictaffil-visibility-option.selected {
    background-color: #4f46e5;
    color: #fff;
    border-color: #4338ca;
}

/* Input fields styling */
.pictaffil-setting-field input[type="text"],
.pictaffil-setting-field input[type="number"],
.pictaffil-setting-field select {
    width: 100%;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pictaffil-setting-field input[type="color"] {
    width: 50px;
    height: 30px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    vertical-align: middle;
}

/* Amazon PAA Settings */
.pictaffil-paa-status {
    margin-top: 10px;
}

/* Style for the API verification success message */
.pictaffil-api-status .notice-success,
.pictaffil-paa-status .notice-success {
    background-color: #f0f8e6;
    border-color: #7ad03a;
}

/* Style for the API verification error message */
.pictaffil-api-status .notice-error,
.pictaffil-paa-status .notice-error {
    background-color: #fbeaea;
    border-color: #dc3232;
}

/* Make inline notices more compact */
.pictaffil-api-status .notice.inline,
.pictaffil-paa-status .notice.inline {
    padding: 8px 12px;
    margin: 10px 0;
}

/* Checkbox and radio styles */
.form-table input[type="checkbox"],
.form-table input[type="radio"] {
    margin-right: 5px;
}

/* Amazon PAA Guide Styles */
.pictaffil-paa-guide-toggle {
    margin-left: 10px;
    text-decoration: none;
    color: #0073aa;
    font-weight: 500;
    font-size: 0.9em;
}

.pictaffil-paa-guide-toggle:hover {
    color: #00a0d2;
    text-decoration: underline;
}

.pictaffil-paa-guide {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: none; /* Hidden by default */
}

.pictaffil-paa-guide h2 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    color: #23282d;
}

.pictaffil-guide-steps {
    counter-reset: step-counter;
}

.pictaffil-guide-step {
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 5px;
    position: relative;
}

.pictaffil-guide-step h3 {
    margin-top: 0;
    color: #0073aa;
    font-size: 16px;
}

.pictaffil-guide-step ol {
    margin-left: 20px;
}

.pictaffil-guide-step li {
    margin-bottom: 8px;
}

.pictaffil-note, .pictaffil-warning {
    padding: 10px 15px;
    margin: 10px 0;
    border-left: 4px solid #00a0d2;
    background: #e5f5fa;
}

.pictaffil-warning {
    border-left-color: #d63638;
    background: #fcf0f1;
}

.pictaffil-troubleshooting {
    margin-top: 20px;
    padding: 15px;
    background: #f0f6fc;
    border-left: 4px solid #72aee6;
}

.pictaffil-troubleshooting h3 {
    margin-top: 0;
    color: #2271b1;
}

.pictaffil-troubleshooting ul {
    margin-left: 20px;
}

.pictaffil-troubleshooting li {
    margin-bottom: 10px;
}

.pictaffil-resources {
    margin-top: 20px;
}

/* Amazon PAA Input Fields Styling */
.pictaffil-paa-field {
    transition: all 0.3s ease;
}

input.pictaffil-paa-field:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Amazon PAA Settings Styles */

.pictaffil-paa-guide-toggle {
    cursor: pointer;
    color: #2271b1;
    text-decoration: none;
    margin-left: 10px;
    display: inline-block;
}

.pictaffil-paa-guide-toggle:hover,
.pictaffil-paa-guide-toggle:focus {
    color: #135e96;
    text-decoration: underline;
}

/* Status message area for credential verification */
.pictaffil-paa-status {
    margin: 10px 0;
}

.pictaffil-paa-status .notice {
    margin: 5px 0;
    padding: 8px 12px;
}

.pictaffil-paa-status .notice p {
    margin: 0.5em 0;
}

/* Styling for the verification button */
#pictaffil-verify-paa-credentials:hover,
#pictaffil-verify-paa-credentials:focus {
    background-color: #f0f0f1;
    border-color: #8c8f94;
}

#pictaffil-verify-paa-credentials:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Styling for credential fields */
.pictaffil-paa-field {
    transition: border-color 0.15s ease-in-out;
}

.pictaffil-paa-field:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: 2px solid transparent;
}

/* PAA enabled checkbox styling */
#pictaffil_paa_enabled {
    margin-right: 8px;
}

/* Improve region select dropdown appearance */
#pictaffil_paa_region {
    min-width: 200px;
}

/* Improve PAA credentials section visibility */
tr:has(.pictaffil-paa-field) {
    transition: opacity 0.3s, max-height 0.3s;
}

/* Smooth fade-in for PAA guide */
.pictaffil-paa-guide {
    transition: opacity 0.3s ease-in-out, max-height 0.5s ease-in-out;
    overflow: hidden;
}

/* Search method radio option styles */
.pictaffil-search-method-option {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

.pictaffil-search-method-option:hover {
    background: #f1f1f1;
}

.pictaffil-search-method-option input[type="radio"] {
    margin-right: 10px;
}

.pictaffil-search-method-option.active {
    border-color: #007cba;
    background: #f0f6fc;
}

/* Amazon PAA Settings */
#pictaffil-paa-settings {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 20px;
}

.pictaffil-paa-guide {
    display: none;
}

/* Settings notice */
.pictaffil-search-notice {
    background: #f0f6fc;
    border-left: 4px solid #007cba;
    padding: 10px 12px;
    margin: 10px 0;
}

/* Fix tab navigation - ensure tab content is visible when active */
.pictaffil-settings-tab-content.active {
    display: block !important;
}

.pictaffil-settings-tab-button.active {
    background-color: #f0f0f0;
    color: #2271b1;
    border-bottom: 2px solid #2271b1;
}

/* Settings tabs layout */
.pictaffil-settings-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.pictaffil-settings-tab-button {
    padding: 8px 15px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s ease;
}
