/**
 * Pictaffil WordPress Plugin Admin CSS
 * 
 * This file contains all the styles for the admin interface of the Pictaffil plugin,
 * adapted from the Chrome extension's popup.css.
 */

/* General Styles */
.pictaffil-admin {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: #1f2937;
    max-width: 1200px;
}

.pictaffil-admin h1 {
    margin-bottom: 20px;
}

.pictaffil-admin h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1f2937;
}

.pictaffil-admin h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #4f46e5;
}

/* Welcome Panel */
.pictaffil-welcome-panel {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pictaffil-welcome-panel h2 {
    margin-top: 0;
}

.pictaffil-welcome-panel .about-description {
    margin-bottom: 20px;
    font-size: 14px;
}

.welcome-panel-column-container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.welcome-panel-column {
    flex: 1;
    min-width: 200px;
}

.welcome-panel-column h3 {
    margin-top: 0;
}

.welcome-panel-column ul {
    margin-top: 12px;
}

.welcome-panel-column li {
    margin-bottom: 8px;
}

/* Account Status */
.pictaffil-account-status {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pictaffil-credits-display {
    background-color: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #f3f4f6;
}

.pictaffil-account-details {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.pictaffil-account-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.pictaffil-account-row:last-child {
    border-bottom: none;
}

.pictaffil-account-subrow {
    padding-left: 20px;
    background-color: #f9f9f9;
    margin-left: 10px;
    border-left: 3px solid #eee;
    font-size: 13px;
}

.pictaffil-account-label {
    font-weight: 500;
    color: #444;
}

.pictaffil-account-value {
    font-weight: 600;
    color: #2271b1;
}

.pictaffil-upgrade-container {
    text-align: center;
    margin-top: 15px;
}

/* Features */
.pictaffil-features {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pictaffil-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 16px;
}

.pictaffil-feature-card {
    background-color: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.pictaffil-feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #e5e7eb;
}

.pictaffil-feature-icon {
    font-size: 24px;
    color: #4f46e5;
    margin-bottom: 12px;
}

.pictaffil-feature-card h3 {
    margin-top: 0;
    margin-bottom: 8px;
}

.pictaffil-feature-card p {
    margin: 0;
    color: #6b7280;
}

/* Settings */
.pictaffil-settings-container {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pictaffil-settings-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f3f4f6;
}

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

.pictaffil-api-status {
    margin-top: 12px;
    min-height: 30px;
}

/* Analyze */
.pictaffil-analyze-container {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pictaffil-analyze-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
}

.pictaffil-tab-button {
    padding: 8px 16px;
    background: none;
    border: none;
    opacity: 0.7;
    font-weight: 400;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pictaffil-tab-button.active {
    opacity: 1;
    color: #4f46e5;
    font-weight: 500;
    border-bottom: 2px solid #4f46e5;
}

.pictaffil-tab-content {
    display: none;
    padding: 16px 0;
}

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

.pictaffil-upload-area {
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    background-color: #f9fafb;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pictaffil-upload-area:hover {
    border-color: #4f46e5;
    background-color: rgba(79, 70, 229, 0.02);
}

.pictaffil-upload-area.pictaffil-drag-over {
    border-color: #4f46e5;
    background-color: rgba(79, 70, 229, 0.05);
}

.pictaffil-dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.pictaffil-file-input {
    display: none;
}

.pictaffil-url-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.pictaffil-url-input-container input {
    flex-grow: 1;
}

.pictaffil-media-container {
    margin-bottom: 16px;
}

.pictaffil-selected-media {
    margin-top: 16px;
}

.pictaffil-selected-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.pictaffil-selected-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

/* Analysis Results */
.pictaffil-analysis-results {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.pictaffil-results-container {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.pictaffil-analyzed-image {
    flex: 0 0 150px;
}

.pictaffil-analyzed-image img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    object-fit: contain;
}

.pictaffil-analysis-info {
    flex: 1;
}

.pictaffil-info-row {
    margin-bottom: 12px;
}

.pictaffil-label {
    font-weight: 500;
    margin-right: 8px;
}

.pictaffil-keywords-container {
    margin-top: 16px;
}

.pictaffil-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.pictaffil-keyword {
    background-color: #f3f4f6;
    color: #4b5563;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.pictaffil-actions {
    margin-bottom: 24px;
}

/* Products */
.pictaffil-products-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    display: block; /* Ensure section is visible */
    display: block !important; /* Force display */
}

.pictaffil-products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    margin-top: 16px;
    margin-bottom: 24px;
}

.pictaffil-product-card {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.pictaffil-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #4f46e5;
}

.pictaffil-product-image {
    height: 180px;
    overflow: hidden;
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pictaffil-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.pictaffil-product-details {
    padding: 16px;
}

.pictaffil-product-title {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 8px 0;
    color: #1f2937;
    line-height: 1.4;
    height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    box-orient: vertical; /* Standard property for compatibility */
}

.pictaffil-product-price {
    font-weight: 600;
    color: #4f46e5;
    margin-bottom: 8px;
}

.pictaffil-product-rating {
    margin-bottom: 12px;
    font-size: 12px;
}

.pictaffil-star {
    color: #f59e0b;
}

.pictaffil-star-empty {
    color: #d1d5db;
}

.pictaffil-rating-value {
    color: #6b7280;
}

.pictaffil-product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pictaffil-product-actions .button {
    flex: 1;
    min-width: 100px;
    text-align: center;
}

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

/* History */
.pictaffil-history-container {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pictaffil-history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pictaffil-history-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    background-color: #f9fafb;
    transition: all 0.2s ease;
}

.pictaffil-history-item:hover {
    border-color: #4f46e5;
    background-color: rgba(79, 70, 229, 0.02);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pictaffil-history-image {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #f3f4f6;
}

.pictaffil-history-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pictaffil-history-details {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pictaffil-history-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.pictaffil-history-id {
    font-weight: 500;
    color: #4f46e5;
}

.pictaffil-history-timestamp {
    font-size: 12px;
    color: #9ca3af;
}

.pictaffil-history-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.pictaffil-history-keyword {
    font-size: 11px;
    padding: 2px 6px;
    background-color: #f3f4f6;
    border-radius: 4px;
    color: #4b5563;
}

.pictaffil-history-actions {
    display: flex;
    gap: 8px;
}

.pictaffil-empty-state {
    text-align: center;
    padding: 32px;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #e5e7eb;
}

.pictaffil-empty-state p {
    margin-bottom: 16px;
    color: #6b7280;
}

/* Loading */
.pictaffil-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.pictaffil-loading:before {
    content: '';
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: pictaffil-spin 1s linear infinite;
}

.pictaffil-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.pictaffil-loader {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: pictaffil-spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes pictaffil-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Notifications */
.pictaffil-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4f46e5;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    max-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.pictaffil-notification-show {
    transform: translateY(0);
    opacity: 1;
}

.pictaffil-notification-success {
    background-color: #10b981;
}

.pictaffil-notification-error {
    background-color: #ef4444;
}

.pictaffil-notification-warning {
    background-color: #f59e0b;
}

.pictaffil-notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    margin-left: 10px;
    padding: 0 5px;
}

/* Public Styles */
.pictaffil-product-display {
    display: flex;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
    background-color: #fff;
    max-width: 600px;
}

.pictaffil-product-image {
    flex: 0 0 200px;
    background-color: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.pictaffil-product-image img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.pictaffil-product-details {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.pictaffil-product-title {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 12px 0;
    color: #1f2937;
    line-height: 1.4;
}

.pictaffil-product-title a {
    color: #1f2937;
    text-decoration: none;
}

.pictaffil-product-title a:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.pictaffil-product-price {
    font-weight: 600;
    color: #4f46e5;
    margin-bottom: 12px;
}

.pictaffil-product-rating {
    margin-bottom: 16px;
}

.pictaffil-product-action {
    margin-top: auto;
}

.pictaffil-product-button {
    display: inline-block;
    background-color: #4f46e5;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.pictaffil-product-button:hover {
    background-color: #4338ca;
    transform: translateY(-1px);
}

/* Selectable Keywords */
.pictaffil-keywords-help {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
}

.pictaffil-keyword {
    display: inline-flex;
    align-items: center;
    background-color: #f3f4f6;
    color: #4b5563;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin: 0 8px 8px 0;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.pictaffil-keyword:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

.pictaffil-keyword:focus-within {
    outline: 2px solid #4f46e5;
    outline-offset: 1px;
}

.pictaffil-keyword-checkbox {
    margin-right: 4px !important;
}

.pictaffil-keyword-list {
    display: flex;
    flex-wrap: wrap;
    margin: 16px 0;
}

.pictaffil-keywords-actions {
    margin-top: 8px;
    margin-bottom: 16px;
}

.pictaffil-selected-keywords {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

#pictaffil-search-selected-keywords {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pictaffil-selected-keyword {
    background-color: rgba(79, 70, 229, 0.1);
    border: 1px solid #4f46e5;
    color: #4f46e5;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.pictaffil-no-keywords {
    color: #6b7280;
    font-style: italic;
    font-size: 13px;
}

.pictaffil-keyword input:checked + label {
    font-weight: 600;
    color: #4f46e5;
}

.pictaffil-keyword:has(input:checked) {
    background-color: rgba(79, 70, 229, 0.1);
    border-color: #4f46e5;
}

/* Responsive */
@media (max-width: 782px) {
    .pictaffil-results-container {
        flex-direction: column;
    }
    
    .pictaffil-analyzed-image {
        flex: 0 0 auto;
        margin-bottom: 16px;
    }
    
    .pictaffil-product-display {
        flex-direction: column;
    }
    
    .pictaffil-product-image {
        flex: 0 0 auto;
    }
}


/* Missing CSS for Pictaffil Admin Page */

/* Intro Text Styling */
.pictaffil-intro {
    font-size: 16px;
    color: #6b7280;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Getting Started Section */
.pictaffil-getting-started {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.pictaffil-step {
    background-color: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
}

.pictaffil-step:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: #e5e7eb;
}

.pictaffil-step h3 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

.pictaffil-step-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Button Styling */
.pictaffil-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #4f46e5;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.pictaffil-button:hover {
    background-color: #4338ca;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.pictaffil-button:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.pictaffil-button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Step Content Lists */
.pictaffil-step-content ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.pictaffil-step-content li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

.pictaffil-step-content li:before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    color: #10b981;
    font-weight: 600;
}

.pictaffil-step-content li:last-child {
    margin-bottom: 0;
}

/* Account Status Notices */
.pictaffil-welcome-panel .notice {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.pictaffil-welcome-panel .notice p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pictaffil-welcome-panel .notice.notice-warning {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.pictaffil-welcome-panel .notice.notice-error {
    background-color: #fee2e2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.pictaffil-welcome-panel .notice .button {
    flex-shrink: 0;
}

/* Credits Display Loading State */
.pictaffil-credits-display .pictaffil-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #6b7280;
    font-size: 14px;
}

.pictaffil-credits-display .pictaffil-loading:before {
    content: '';
    width: 16px;
    height: 16px;
    margin-right: 12px;
    border: 2px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: pictaffil-spin 1s linear infinite;
}

/* Account Status Section */
.pictaffil-welcome-panel h2:not(:first-child) {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #f3f4f6;
}

/* Enhanced Feature Cards */
.pictaffil-feature-card {
    text-align: center;
}

.pictaffil-feature-card .pictaffil-feature-icon {
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    background-color: rgba(79, 70, 229, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pictaffil-feature-card .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #4f46e5;
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .pictaffil-getting-started {
        grid-template-columns: 1fr;
    }
    
    .pictaffil-feature-grid {
        grid-template-columns: 1fr;
    }
    
    .pictaffil-welcome-panel .notice {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pictaffil-welcome-panel .notice p {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .pictaffil-welcome-panel .notice .button {
        margin-top: 8px;
    }
}

/* Ensure proper spacing and layout */
.pictaffil-admin .wrap {
    margin-right: 20px;
}

.pictaffil-admin h1 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

/* Additional button variations for different contexts */
.pictaffil-button.button-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.pictaffil-button.button-secondary:hover {
    background-color: #e5e7eb;
    color: #1f2937;
    border-color: #9ca3af;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pictaffil-button.button-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* Focus states for accessibility */
.pictaffil-step:focus-within {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.pictaffil-feature-card:focus-within {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Loading animation improvements */
@keyframes pictaffil-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Improve product grid display */
.pictaffil-product-results {
    margin: 20px 0;
    min-height: 100px; /* Ensure container has height */
    width: 100%;
    position: relative; /* For proper rendering */
    min-height: 50px;
}

/* Chrome-style Product Cards - Fixed to 4 columns */
.pictaffil-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 992px) {
    .pictaffil-products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .pictaffil-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .pictaffil-products-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

.pictaffil-products-grid .pictaffil-product-card {
    border: 1px solid #f3f4f6;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    background-color: white;
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-bottom: 0;
}

/* Fix for keyword selection */
.pictaffil-keyword {
    display: inline-flex;
    align-items: center;
    margin: 0 8px 8px 0;
    background-color: #f3f4f6;
    border-radius: 4px;
    padding: 4px 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pictaffil-keyword:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

.pictaffil-keyword input[type="checkbox"] {
    margin-right: 5px !important;
}

.pictaffil-keyword input:checked + label {
    font-weight: 600;
    color: #4f46e5;
}

.pictaffil-keyword:has(input:checked) {
    background-color: rgba(79, 70, 229, 0.1);
    border-color: #4f46e5;
}

/* Ensure products section is visible */
.pictaffil-products-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    display: block !important; /* Force display */
}

.pictaffil-product-results {
    min-height: 50px;
    width: 100%;
    position: relative;
    margin: 20px 0;
}

/* Better notification styling for product operations */
.pictaffil-notification-container {
    position: fixed;
    top: 50px;
    right: 20px;
    z-index: 9999;
    max-width: 300px;
}

.pictaffil-notification {
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s forwards;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.pictaffil-notification-show {
    display: block;
}

.pictaffil-notification-message {
    padding-right: 10px;
    flex-grow: 1;
}

/* Add loading indicator styling */
.pictaffil-loading {
    text-align: center;
    padding: 20px;
    color: #555;
    position: relative;
    padding-left: 25px;
}

.pictaffil-loading:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    margin-top: -8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: #4f46e5;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Advanced Settings */
.pictaffil-advanced-options {
    margin-top: 15px;
}

.pictaffil-advanced-option {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f3f4f6;
}

.pictaffil-advanced-option:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.button-danger {
    background-color: #ef4444 !important;
    border-color: #dc2626 !important;
    color: white !important;
}

.button-danger:hover {
    background-color: #dc2626 !important;
    border-color: #b91c1c !important;
}

.pictaffil-reset-confirm {
    margin-top: 10px;
    margin-bottom: 20px;
}

/* Remove Debug Console */
.pictaffil-debug-console {
    display: none;
}

/* Editor Panel Styles */
.pictaffil-editor-panel {
    margin: 20px 0;
}

.pictaffil-editor-columns {
    display: flex;
    gap: 20px;
}

.pictaffil-editor-column {
    flex: 1;
    min-width: 0;
}

.pictaffil-images-column {
    flex: 0 0 40%;
}

.pictaffil-post-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.pictaffil-post-image {
    width: 100%;
    height: 120px;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pictaffil-post-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pictaffil-post-image.selected {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

.pictaffil-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pictaffil-selected-image-container {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.pictaffil-selected-image img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 4px;
    margin-bottom: 15px;
}

/* Editor Analysis Results */
.pictaffil-analysis-results {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.pictaffil-search-actions {
    margin-top: 15px;
}

/* Fix keyword display in editor */
#pictaffil-analysis-results .pictaffil-keyword {
    display: inline-flex;
    align-items: center;
    margin: 0 8px 8px 0;
    padding: 4px 8px;
    background-color: #f3f4f6;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

#pictaffil-analysis-results .pictaffil-keyword:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
}

#pictaffil-analysis-results .pictaffil-keyword.pictaffil-keyword-selected {
    background-color: rgba(79, 70, 229, 0.1);
    border-color: #4f46e5;
}



/* Settings Page Styles */
/* Main Container Styles */
.pictaffil-settings-container {
    margin-top: 20px;
    max-width: 1200px;
}

/* Tabs Navigation */
.pictaffil-settings-tabs {
    margin-bottom: 20px;
    border-bottom: 1px solid #ccc;
}

.pictaffil-tab-nav {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pictaffil-tab-nav li {
    margin-bottom: -1px;
}

.pictaffil-tab-nav li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: #646970;
    border: 1px solid transparent;
    border-bottom: none;
    font-weight: 500;
}

.pictaffil-tab-nav li a:hover {
    color: #2271b1;
    background: #f0f0f1;
}

.pictaffil-tab-nav li.active a {
    background: #fff;
    color: #2271b1;
    border-color: #ccc;
    border-bottom-color: #fff;
}

/* Tab Content */
.pictaffil-tab-content {
    display: none;
}

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

/* Card Layout */
.pictaffil-settings-card {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pictaffil-settings-card h2 {
    margin: 0;
    padding: 15px 20px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    font-weight: 600;
}

.pictaffil-card-content {
    padding: 20px;
}

.pictaffil-description {
    margin-top: 0;
    margin-bottom: 15px;
    color: #646970;
}

/* Field Layout */
.pictaffil-field-row {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
}

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

.pictaffil-field-row > label {
    flex: 0 0 200px;
    font-weight: 500;
    padding-top: 5px;
}

.pictaffil-field-input {
    flex: 1;
    min-width: 0;
}

.pictaffil-help-text {
    margin-top: 5px;
    color: #646970;
    font-size: 13px;
    font-style: italic;
}

/* Toggle Switch */
.pictaffil-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.pictaffil-toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    background-color: #ccc;
    border-radius: 10px;
    margin-right: 10px;
    transition: all 0.3s;
}

.pictaffil-toggle-switch:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    border-radius: 50%;
    background-color: white;
    transition: all 0.3s;
}

.pictaffil-toggle input[type="checkbox"] {
    display: none;
}

.pictaffil-toggle input[type="checkbox"]:checked + .pictaffil-toggle-switch {
    background-color: #2271b1;
}

.pictaffil-toggle input[type="checkbox"]:checked + .pictaffil-toggle-switch:before {
    transform: translateX(16px);
}

/* Radio Tiles */
.pictaffil-radio-tiles {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.pictaffil-radio-tile {
    flex: 1;
    min-width: 180px;
}

.pictaffil-radio-tile input[type="radio"] {
    display: none;
}

.pictaffil-radio-tile label {
    display: block;
    padding: 15px;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.pictaffil-radio-tile label:hover {
    background: #f0f0f1;
    border-color: #c0c0c0;
}

.pictaffil-radio-tile input[type="radio"]:checked + label {
    background: #f0f7fb;
    border-color: #2271b1;
}

.pictaffil-radio-icon {
    text-align: center;
    margin-bottom: 10px;
    color: #2271b1;
}

.pictaffil-radio-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.pictaffil-radio-label {
    font-weight: 600;
    margin-bottom: 5px;
    text-align: center;
}

.pictaffil-radio-desc {
    font-size: 13px;
    color: #646970;
    text-align: center;
}

/* Card Style Selector */
.pictaffil-card-style-selector {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.pictaffil-card-style-option {
    flex: 0 0 auto;
    width: 150px;
}

.pictaffil-card-style-option input[type="radio"] {
    display: none;
}

.pictaffil-card-style-preview {
    height: 180px;
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 5px;
    transition: all 0.3s;
}

.pictaffil-card-style-option input[type="radio"]:checked + label .pictaffil-card-style-preview {
    border-color: #2271b1;
    background: #f0f7fb;
}

.pictaffil-card-style-name {
    text-align: center;
    font-weight: 600;
    margin-bottom: 5px;
}

.pictaffil-help-text {
    font-size: 12px;
    color: #646970;
    text-align: center;
}

/* Preview Elements */
.preview-image {
    width: 100%;
    height: 80px;
    background: #ddd;
    margin-bottom: 10px;
}

.preview-title {
    height: 10px;
    background: #ddd;
    margin-bottom: 10px;
    width: 90%;
}

.preview-price {
    height: 8px;
    background: #ddd;
    margin-bottom: 10px;
    width: 40%;
}

.preview-rating {
    height: 8px;
    background: #ddd;
    margin-bottom: 10px;
    width: 60%;
}

.preview-button {
    height: 20px;
    background: #ddd;
    width: 100%;
}

/* Info Box */
.pictaffil-info-box {
    background: #f0f7fb;
    border-left: 4px solid #2271b1;
    padding: 15px;
    display: flex;
    margin-bottom: 20px;
}

.pictaffil-info-icon {
    flex: 0 0 40px;
    color: #2271b1;
}

.pictaffil-info-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.pictaffil-info-content {
    flex: 1;
}

.pictaffil-info-content p {
    margin-top: 0;
}

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

/* Advanced Section */
.pictaffil-advanced-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pictaffil-advanced-option {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.pictaffil-option-header {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}

.pictaffil-option-icon {
    margin-right: 10px;
    color: #646970;
}

.pictaffil-option-title {
    font-weight: 600;
}

.pictaffil-option-content {
    padding: 15px;
}

/* Warning Box */
.pictaffil-warning-box {
    background: #fcf9e8;
    border-left: 4px solid #dba617;
    padding: 15px;
    margin: 15px 0;
}

.pictaffil-warning-actions {
    margin-top: 15px;
}

.button-danger {
    color: #a00;
    border-color: #a00;
}

.button-danger:hover {
    color: #dc3232;
    border-color: #dc3232;
}

/* Submit Section */
.pictaffil-submit-section {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.pictaffil-settings-saved {
    margin-left: 15px;
    color: #46b450;
    font-weight: 500;
}

/* Responsive Adjustments */
@media (max-width: 782px) {
    .pictaffil-tab-nav {
        flex-wrap: wrap;
    }
    
    .pictaffil-field-row > label {
        flex: 0 0 100%;
        margin-bottom: 5px;
    }
    
    .pictaffil-field-input {
        flex: 0 0 100%;
    }
    
    .pictaffil-radio-tiles {
        flex-direction: column;
    }
    
    .pictaffil-card-style-selector {
        justify-content: center;
    }
}
