/**
 * Pictaffil Editor Panel CSS
 * Handles all styles for the post editor panel
 */

/* Hidden elements */
.pictaffil-hidden,
.pictaffil-initially-hidden {
    display: none !important;
}

/* Main editor panel container */
.pictaffil-editor-panel {
    background: #fff;
    border: 1px solid #e2e4e7;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin: 20px 0;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.pictaffil-editor-container {
    position: relative;
}

/* Two-column layout */
.pictaffil-editor-columns {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
    gap: 20px;
}

.pictaffil-editor-column {
    flex: 1;
    min-width: 300px;
    padding: 0 10px;
}

/* Column headings */
.pictaffil-editor-column h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
}

/* Post images section */
.pictaffil-post-images {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background: #f9f9f9;
}

.pictaffil-post-image {
    margin-bottom: 10px;
    cursor: pointer;
    padding: 5px;
    border: 2px solid transparent;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.pictaffil-post-image:hover {
    border-color: #ddd;
}

.pictaffil-post-image.active {
    border-color: #4f46e5;
    background: rgba(79, 70, 229, 0.05);
}

.pictaffil-post-image img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    display: block;
}

/* Selected image */
.pictaffil-selected-image-container {
    margin-bottom: 15px;
    text-align: center;
}

.pictaffil-selected-image {
    margin-bottom: 10px;
    max-height: 200px;
    overflow: hidden;
    border: 1px solid #ddd;
    padding: 5px;
    border-radius: 4px;
}

.pictaffil-selected-image img {
    max-width: 100%;
    max-height: 190px;
    object-fit: contain;
}

/* Empty state */
.pictaffil-empty-state {
    padding: 20px;
    text-align: center;
    color: #757575;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 4px;
}

/* Analysis results */
.pictaffil-analysis-results {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background: #f9f9f9;
}

.pictaffil-analysis-results h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

.pictaffil-results-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.pictaffil-analyzed-image {
    width: 120px;
    min-width: 120px;
    border: 1px solid #ddd;
    padding: 5px;
    background: white;
    border-radius: 4px;
}

.pictaffil-analyzed-image img {
    width: 100%;
    height: auto;
}

.pictaffil-analysis-info {
    flex: 1;
    min-width: 200px;
}

.pictaffil-info-row {
    margin-bottom: 10px;
}

.pictaffil-label {
    font-weight: 600;
    margin-right: 5px;
}

/* Keywords */
.pictaffil-keywords-container {
    margin-top: 15px;
}

.pictaffil-keywords-header {
    margin-bottom: 10px;
    color: #666;
}

.pictaffil-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
}

.pictaffil-keyword {
    background: #e9e9e9;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.pictaffil-keyword:hover {
    background: #d9d9d9;
}

.pictaffil-keyword.selected {
    background: #4f46e5;
    color: white;
}

.pictaffil-custom-keyword {
    margin: 15px 0;
}

.pictaffil-custom-keyword label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.pictaffil-custom-keyword-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pictaffil-search-actions {
    margin-top: 15px;
}

/* Product results */
.pictaffil-products-section {
    margin-top: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    background: #f9f9f9;
}

.pictaffil-products-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

.pictaffil-product-results {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.pictaffil-product-card {
    width: calc(33.33% - 10px);
    min-width: 180px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pictaffil-product-card:hover {
    border-color: #4f46e5;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.pictaffil-product-card.selected {
    border-color: #4f46e5;
    background: rgba(79, 70, 229, 0.05);
}

.pictaffil-product-image {
    text-align: center;
    margin-bottom: 10px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pictaffil-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pictaffil-product-title {
    font-size: 12px;
    line-height: 1.4;
    font-weight: 400;
    margin-bottom: 5px;
    max-height: 50px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* Standard property fallback */
    -webkit-box-orient: vertical;
    box-orient: vertical; /* Standard property fallback */
}

.pictaffil-product-price {
    font-weight: 600;
    color: #e63946;
    margin-bottom: 5px;
}

.pictaffil-product-rating {
    font-size: 12px;
    color: #666;
}

.pictaffil-product-stars {
    color: #f8c42a;
}

.pictaffil-product-card .pictaffil-product-desc {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* Standard property fallback */
    -webkit-box-orient: vertical;
    box-orient: vertical; /* Standard property fallback */
}

/* Saved Products Section */
.pictaffil-saved-products-section {
    margin-top: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.pictaffil-saved-products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
}

.pictaffil-saved-products-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.pictaffil-saved-products-actions {
    display: flex;
    gap: 5px;
}

.pictaffil-saved-products-container {
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.pictaffil-saved-product {
    display: flex;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.pictaffil-saved-product:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.pictaffil-saved-product-image {
    width: 60px;
    min-width: 60px;
    height: 60px;
    margin-right: 10px;
    border: 1px solid #eee;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pictaffil-saved-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pictaffil-saved-product-info {
    flex: 1;
}

.pictaffil-saved-product-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
}

.pictaffil-saved-product-meta {
    display: flex;
    font-size: 11px;
    color: #666;
    gap: 10px;
}

.pictaffil-saved-product-actions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

/* Tab Navigation */
.pictaffil-tab-button {
    border-bottom: 2px solid transparent;
}

.pictaffil-tab-button.active {
    background: #f0f0f1;
    border-bottom-color: #4f46e5;
}

.pictaffil-saved-products-tabs {
    position: relative;
}

.pictaffil-tab-content {
    display: none;
}

.pictaffil-tab-content.active {
    display: block;
}

/* Carousel Settings Tab */
.pictaffil-carousel-settings {
    padding: 15px;
}

.pictaffil-settings-tabs {
    margin-bottom: 15px;
}

.pictaffil-settings-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
    gap: 5px;
}

.pictaffil-settings-tab-button {
    padding: 8px 12px;
    background: #f9f9f9;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    outline: none;
}

.pictaffil-settings-tab-button:hover {
    background: #f0f0f1;
}

.pictaffil-settings-tab-button.active {
    background: #fff;
    border-bottom-color: #4f46e5;
    font-weight: 600;
}

.pictaffil-settings-tab-content {
    display: none;
}

.pictaffil-settings-tab-content.active {
    display: block;
}

.pictaffil-settings-grid {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px;
}

.pictaffil-settings-column {
    flex: 1;
    min-width: 250px;
    padding: 0 10px;
}

.pictaffil-settings-block {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.pictaffil-block-heading {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 13px;
    font-weight: 600;
}

.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-setting-help {
    font-size: 11px;
    color: #666;
    margin: 4px 0 0;
}

/* Color picker fields */
.pictaffil-color-field {
    display: flex;
    align-items: center;
}

.pictaffil-color-field label {
    min-width: 120px;
}

.pictaffil-color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pictaffil-color-picker-wrapper input[type="color"] {
    width: 30px;
    height: 30px;
    border: 1px solid #ddd;
    padding: 0;
    background: none;
}

.pictaffil-color-hex {
    width: 70px;
    font-size: 13px;
}

/* Checkboxes */
.pictaffil-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.pictaffil-checkbox-label input[type="checkbox"] {
    margin: 0;
}

/* Option groups */
.pictaffil-options-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.pictaffil-options-group > div {
    flex: 1;
    min-width: 80px;
    max-width: 100px;
    text-align: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background: white;
    transition: border-color 0.2s, background-color 0.2s;
}

.pictaffil-options-group > div:hover {
    background: #f0f0f1;
}

.pictaffil-options-group > div.selected {
    border-color: #4f46e5;
    background: rgba(79, 70, 229, 0.1);
}

.pictaffil-options-group .dashicons {
    display: block;
    margin: 0 auto 5px;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.pictaffil-option-label {
    display: block;
    font-size: 12px;
}

/* Range slider */
.pictaffil-range-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pictaffil-range-field input[type="range"] {
    flex: 1;
}

.pictaffil-range-value {
    width: 60px;
    text-align: center;
}

/* Info blocks */
.pictaffil-info-block {
    background: #f0f7fb;
    border-color: #d0e3f0;
}

.pictaffil-info-content {
    font-size: 12px;
    color: #555;
}

.pictaffil-info-content ul {
    margin: 8px 0 8px 15px;
    padding: 0;
}

.pictaffil-info-content p {
    margin: 8px 0;
}

.pictaffil-preview-tip {
    font-style: italic;
    font-size: 11px;
}

/* Settings actions */
.pictaffil-settings-actions {
    display: flex;
    justify-content: space-between;
    padding: 0 15px 15px;
}

/* Loading state */
.pictaffil-loading {
    padding: 20px;
    text-align: center;
    color: #666;
}

.pictaffil-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.pictaffil-loader {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid #3498db;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#pictaffil-loading-message {
    font-size: 14px;
    color: #333;
}

/* Grid layout for settings */
.pictaffil-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.pictaffil-settings-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pictaffil-settings-block {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 0;
}

.pictaffil-block-heading {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

.pictaffil-setting-field {
    margin-bottom: 12px;
}

.pictaffil-setting-field:last-child {
    margin-bottom: 0;
}

@media (max-width: 782px) {
    .pictaffil-settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Square checkboxes styling */
.pictaffil-editor-panel input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #7e8993;
    border-radius: 2px;
    background-color: #fff;
    margin-right: 8px;
    position: relative;
    cursor: pointer;
    vertical-align: middle;
}

.pictaffil-editor-panel input[type="checkbox"]:checked {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

.pictaffil-editor-panel input[type="checkbox"]:checked::before {
    content: '\2713';
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pictaffil-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

/* Amazon button styling */
.pictaffil-product-button a,
.pictaffil-product-button .button,
.pictaffil-product-button button {
    width: 50% !important;
    margin: 0 auto !important;
    display: block !important;
    box-sizing: border-box !important;
}

/* Vertical layout for side carousel product cards */
.pictaffil-side-carousel .pictaffil-product-card {
    display: flex !important;
    flex-direction: column !important;
}

.pictaffil-side-carousel .pictaffil-product-image {
    width: 100%;
    margin-bottom: 10px;
}

.pictaffil-side-carousel .pictaffil-product-details {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.pictaffil-side-carousel .pictaffil-product-name {
    margin-bottom: 5px;
    order: 1;
}

.pictaffil-side-carousel .pictaffil-product-price {
    margin-bottom: 5px;
    order: 2;
}

.pictaffil-side-carousel .pictaffil-product-rating {
    margin-bottom: 5px;
    order: 3;
}

.pictaffil-side-carousel .pictaffil-product-button {
    order: 4;
}