/**
 * Smart Match for WooCommerce - Metabox Styles
 *
 * @package Smart_Match_For_WooCommerce
 */

/* Metabox container */
.smfwc-metabox {
    padding: 0;
}

/* Setup prompt */
.smfwc-setup-prompt {
    text-align: center;
    padding: 15px;
}

.smfwc-setup-prompt p {
    margin-bottom: 15px;
    color: #666;
}

/* Notices */
.smfwc-notice {
    padding: 10px 12px;
    margin-bottom: 12px;
    border-left: 4px solid #72aee6;
    background: #f0f6fc;
    position: relative;
}

.smfwc-notice-warning {
    border-left-color: #dba617;
    background: #fcf9e8;
}

.smfwc-notice-info {
    border-left-color: #72aee6;
    background: #f0f6fc;
}

.smfwc-notice p {
    margin: 0;
    font-size: 13px;
}

.smfwc-dismissible .smfwc-dismiss-notice {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 0;
}

.smfwc-dismissible .smfwc-dismiss-notice:hover {
    color: #d63638;
}

/* Header */
.smfwc-metabox-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.smfwc-metabox-header .smfwc-generate-content-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.smfwc-metabox-header .smfwc-generate-content-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.smfwc-settings-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
}

.smfwc-settings-btn:hover {
    background: #f6f7f7;
    border-color: #999;
    color: #333;
}

.smfwc-settings-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Description */
.smfwc-description {
    color: #666;
    font-size: 12px;
    margin: 0 0 15px 0;
}

/* Warnings container */
.smfwc-warnings {
    margin-bottom: 15px;
}

/* Results section */
.smfwc-results {
    border-top: 1px solid #ddd;
    padding-top: 15px;
    margin-top: 15px;
}

.smfwc-results-header {
    margin-bottom: 10px;
}

/* Suggestions list */
.smfwc-suggestions-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.smfwc-suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s ease;
}

.smfwc-suggestion-item:last-child {
    border-bottom: none;
}

.smfwc-suggestion-item:hover {
    background: #f9f9f9;
}

/* Confidence-based row backgrounds */
.smfwc-suggestion-item.smfwc-row-high {
    background: linear-gradient(90deg, rgba(212, 237, 218, 0.5) 0%, rgba(212, 237, 218, 0.1) 100%);
}
.smfwc-suggestion-item.smfwc-row-high:hover {
    background: linear-gradient(90deg, rgba(212, 237, 218, 0.7) 0%, rgba(212, 237, 218, 0.2) 100%);
}
.smfwc-suggestion-item.smfwc-row-medium {
    background: linear-gradient(90deg, rgba(255, 243, 205, 0.5) 0%, rgba(255, 243, 205, 0.1) 100%);
}
.smfwc-suggestion-item.smfwc-row-medium:hover {
    background: linear-gradient(90deg, rgba(255, 243, 205, 0.7) 0%, rgba(255, 243, 205, 0.2) 100%);
}
.smfwc-suggestion-item.smfwc-row-low {
    background: linear-gradient(90deg, rgba(248, 215, 218, 0.5) 0%, rgba(248, 215, 218, 0.1) 100%);
}
.smfwc-suggestion-item.smfwc-row-low:hover {
    background: linear-gradient(90deg, rgba(248, 215, 218, 0.7) 0%, rgba(248, 215, 218, 0.2) 100%);
}

.smfwc-suggestion-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.smfwc-suggestion-checkbox {
    margin: 0 !important;
    margin-top: 2px !important;
}

.smfwc-suggestion-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
}

.smfwc-suggestion-parent {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

.smfwc-suggestion-name {
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
    line-height: 1.4;
}

.smfwc-suggestion-confidence {
    font-size: 11px;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

.smfwc-confidence-high {
    color: #155724;
}

.smfwc-confidence-medium {
    color: #856404;
}

.smfwc-confidence-low {
    color: #721c24;
}

.smfwc-all-assigned {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Token usage */
.smfwc-token-usage {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f6f7f7;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.smfwc-token-usage .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 5px;
    vertical-align: text-bottom;
}

/* Apply section */
.smfwc-apply-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.smfwc-apply-btn {
    width: 100%;
}

/* Error and success messages */
.smfwc-error,
.smfwc-success {
    padding: 12px;
    border-radius: 4px;
    margin-top: 15px;
}

.smfwc-error {
    background: #fcf0f1;
    border-left: 4px solid #d63638;
    color: #8a1f1f;
}

.smfwc-success {
    background: #edfaef;
    border-left: 4px solid #00a32a;
    color: #0a5c16;
}

.smfwc-error .dashicons,
.smfwc-success .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    vertical-align: text-bottom;
}

/* Last analysis timestamp */
.smfwc-last-analysis {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 11px;
    color: #999;
}

/* Footer */
.smfwc-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 12px;
}

.smfwc-footer a {
    color: #2271b1;
    text-decoration: none;
}

.smfwc-footer a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Modal styles */
.smfwc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smfwc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.smfwc-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.smfwc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #f6f7f7;
}

.smfwc-modal-header h3 {
    margin: 0;
    font-size: 16px;
}

.smfwc-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 0;
}

.smfwc-modal-close:hover {
    color: #d63638;
}

.smfwc-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.smfwc-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    background: #f6f7f7;
}

/* Quick settings modal */
.smfwc-setting-row {
    margin-bottom: 15px;
}

.smfwc-setting-row:last-child {
    margin-bottom: 0;
}

.smfwc-setting-row > label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.smfwc-setting-row input[type="number"] {
    width: 80px;
}

.smfwc-setting-row input[type="checkbox"] {
    margin-right: 8px;
}

.smfwc-radio-group {
    display: flex;
    gap: 20px;
    margin-top: 5px;
}

.smfwc-radio-group label {
    font-weight: normal;
}

.smfwc-setting-description {
    color: #666;
    font-size: 12px;
    font-style: italic;
    margin: 8px 0 0 0;
}

/* Apply modal */
.smfwc-categories-preview {
    margin: 10px 0;
    padding-left: 20px;
}

.smfwc-categories-preview li {
    margin-bottom: 5px;
    color: #333;
}

.smfwc-apply-note {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-top: 15px;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    .smfwc-modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* ============================================
   Content Generator Section (legacy standalone)
   ============================================ */

/* ============================================
   Content Generator Full-Screen Modal
   ============================================ */

body.smfwc-cg-modal-open {
    overflow: hidden;
}

.smfwc-cg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smfwc-cg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.smfwc-cg-panel {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 60px rgba(0, 0, 0, 0.4);
    width: 90%;
    max-width: 800px;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.smfwc-cg-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #ddd;
    background: #f6f7f7;
    flex-shrink: 0;
}

.smfwc-cg-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.smfwc-cg-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.smfwc-cg-close:hover {
    color: #d63638;
    background: #fcf0f1;
}

.smfwc-cg-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

/* Body */
.smfwc-cg-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Options section */
.smfwc-cg-options {
    margin-bottom: 20px;
}

.smfwc-cg-section {
    margin-bottom: 16px;
}

.smfwc-cg-section h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

/* Checkboxes */
.smfwc-cg-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.smfwc-cg-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
}

/* Inline options (style + length) */
.smfwc-cg-inline-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.smfwc-cg-option-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.smfwc-cg-option-group label {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

.smfwc-cg-option-group select {
    min-width: 160px;
}

/* Generate button */
.smfwc-cg-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.smfwc-cg-generate-btn .smfwc-cg-spinner {
    margin: 0;
    float: none;
}

/* Messages */
.smfwc-cg-messages {
    margin-bottom: 16px;
}

.smfwc-cg-error,
.smfwc-cg-success {
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
}

.smfwc-cg-error {
    background: #fcf0f1;
    border-left: 4px solid #d63638;
    color: #8a1f1f;
}

.smfwc-cg-success {
    background: #edfaef;
    border-left: 4px solid #00a32a;
    color: #0a5c16;
}

.smfwc-cg-error .dashicons,
.smfwc-cg-success .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 4px;
    vertical-align: text-bottom;
}

/* Results */
.smfwc-cg-results {
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.smfwc-cg-result-section {
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
}

.smfwc-cg-result-header {
    margin-bottom: 10px;
}

.smfwc-cg-result-header label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
}

.smfwc-cg-current {
    padding: 8px 12px;
    background: #f0f0f1;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #666;
}

.smfwc-cg-suggested {
    margin-bottom: 4px;
    font-size: 13px;
}

.smfwc-cg-label {
    font-weight: 600;
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Input fields */
.smfwc-cg-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.smfwc-cg-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    resize: vertical;
    box-sizing: border-box;
}

/* Description preview */
.smfwc-cg-description-preview {
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.6;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.smfwc-cg-description-preview p {
    margin: 0 0 12px 0;
}

.smfwc-cg-description-preview p:last-child {
    margin-bottom: 0;
}

.smfwc-cg-toggle-html {
    font-size: 12px !important;
    padding: 2px 8px !important;
}

/* Tags */
.smfwc-cg-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.smfwc-cg-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f0f0f1;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.smfwc-cg-tag:hover {
    background: #e0e0e1;
    border-color: #999;
}

/* Token usage */
.smfwc-cg-token-usage {
    margin-top: 12px;
    padding: 8px 12px;
    background: #f6f7f7;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

.smfwc-cg-token-usage .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    vertical-align: text-bottom;
}

/* Footer */
.smfwc-cg-footer {
    padding: 12px 24px;
    border-top: 1px solid #ddd;
    background: #f6f7f7;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.smfwc-cg-apply-note {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin: 0;
    flex: 1;
}

.smfwc-cg-footer-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Categories in modal */
.smfwc-cg-categories-list {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    max-height: 300px;
    overflow-y: auto;
}

.smfwc-cg-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s ease;
}

.smfwc-cg-category-item:last-child {
    border-bottom: none;
}

.smfwc-cg-category-item:hover {
    background: #f9f9f9;
}

/* Confidence-based row backgrounds */
.smfwc-cg-cat-high {
    background: linear-gradient(90deg, rgba(212, 237, 218, 0.5) 0%, rgba(212, 237, 218, 0.1) 100%);
}
.smfwc-cg-cat-high:hover {
    background: linear-gradient(90deg, rgba(212, 237, 218, 0.7) 0%, rgba(212, 237, 218, 0.2) 100%);
}
.smfwc-cg-cat-medium {
    background: linear-gradient(90deg, rgba(255, 243, 205, 0.5) 0%, rgba(255, 243, 205, 0.1) 100%);
}
.smfwc-cg-cat-medium:hover {
    background: linear-gradient(90deg, rgba(255, 243, 205, 0.7) 0%, rgba(255, 243, 205, 0.2) 100%);
}
.smfwc-cg-cat-low {
    background: linear-gradient(90deg, rgba(248, 215, 218, 0.5) 0%, rgba(248, 215, 218, 0.1) 100%);
}
.smfwc-cg-cat-low:hover {
    background: linear-gradient(90deg, rgba(248, 215, 218, 0.7) 0%, rgba(248, 215, 218, 0.2) 100%);
}

.smfwc-cg-category-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.smfwc-cg-category-check {
    margin: 0 !important;
    margin-top: 2px !important;
}

.smfwc-cg-category-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: 2px;
}

.smfwc-cg-category-parent {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

.smfwc-cg-category-name {
    font-size: 13px;
    font-weight: 500;
    color: #1d2327;
    line-height: 1.4;
}

.smfwc-cg-category-confidence {
    font-size: 11px;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

.smfwc-cg-confidence-high {
    color: #155724;
}

.smfwc-cg-confidence-medium {
    color: #856404;
}

.smfwc-cg-confidence-low {
    color: #721c24;
}

.smfwc-cg-categories-empty {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 0;
}

/* Variation descriptions in modal */
.smfwc-cg-variation-note {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin: 4px 0 0 0;
}

.smfwc-cg-variation-count {
    font-weight: normal;
    color: #666;
    font-size: 13px;
}

.smfwc-cg-variations-list {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    max-height: 400px;
    overflow-y: auto;
}

.smfwc-cg-variation-item {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
}

.smfwc-cg-variation-item:last-child {
    border-bottom: none;
}

.smfwc-cg-variation-header {
    margin-bottom: 6px;
}

.smfwc-cg-variation-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    margin: 0;
    font-size: 13px;
}

.smfwc-cg-variation-attrs {
    font-weight: 500;
    color: #1d2327;
}

.smfwc-cg-variation-desc {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    resize: vertical;
    box-sizing: border-box;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .smfwc-cg-panel {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .smfwc-cg-inline-options {
        flex-direction: column;
        gap: 12px;
    }

    .smfwc-cg-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .smfwc-cg-footer-actions {
        justify-content: flex-end;
    }
}
