/**
 * Comparison Tables - Front-end Admin Mode Styles
 * Only loaded when admin is logged in viewing the search page
 * Updated to match React/Tailwind design system
 */

/* +Compare button on product cards */
.psfa-add-to-compare-btn {
    position: absolute;
    top: 44px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--color-primary, #10b981);
    color: var(--color-primary-foreground, white);
    border: none;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    font-family: inherit;
}

/* Show button on card hover */
.psfa-product:hover .psfa-add-to-compare-btn,
.psfa-product-card:hover .psfa-add-to-compare-btn {
    opacity: 1;
    transform: translateY(0);
}

.psfa-add-to-compare-btn:hover {
    background: var(--color-primary-hover, #059669);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.psfa-add-to-compare-btn:active {
    transform: scale(0.97);
}

.psfa-add-to-compare-btn:focus-visible {
    outline: 2px solid var(--color-primary, #10b981);
    outline-offset: 2px;
}

/* Icon */
.psfa-compare-icon {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
}

/* Loading state */
.psfa-add-to-compare-btn.psfa-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ============================================
   TABLE SELECTION MODAL
   ============================================ */
.psfa-compare-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.psfa-compare-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.psfa-compare-modal-content {
    position: relative;
    background: var(--color-background, white);
    border-radius: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: psfa-modal-in 0.2s ease-out;
    border: 1px solid var(--color-border, #e2e8f0);
    font-family: inherit;
}

@keyframes psfa-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.psfa-compare-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.psfa-compare-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.psfa-compare-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.psfa-compare-modal-close:hover {
    color: #374151;
}

.psfa-compare-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Tables List */
.psfa-tables-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.psfa-tables-list:empty::before {
    content: 'No tables yet. Create one below.';
    display: block;
    color: #9ca3af;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.psfa-select-table-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.psfa-select-table-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.psfa-select-table-btn .psfa-table-name {
    font-size: 14px;
    font-weight: 500;
    color: #111;
}

.psfa-select-table-btn .psfa-table-count {
    font-size: 12px;
    color: #6b7280;
    background: #e5e7eb;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Create New Table */
.psfa-create-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

.psfa-create-section label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 8px;
}

.psfa-quick-create-form {
    display: flex;
    gap: 8px;
}

.psfa-quick-create-form input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.psfa-quick-create-form input:focus {
    outline: none;
    border-color: var(--color-primary, #10b981);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary, #10b981) 15%, transparent);
}

.psfa-quick-create-form button {
    padding: 10px 16px;
    background: var(--color-primary, #10b981);
    color: var(--color-primary-foreground, white);
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.psfa-quick-create-form button:hover {
    background: var(--color-primary-hover, #059669);
}

.psfa-quick-create-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast notification - modern design */
.psfa-compare-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--color-background, #ffffff);
    color: var(--color-foreground, #0f172a);
    padding: 16px 20px;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    z-index: 100001;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-border, #e2e8f0);
    animation: psfa-toast-in 0.3s ease-out;
    font-family: inherit;
}

/* Success indicator */
.psfa-compare-toast::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-primary, #10b981);
    color: var(--color-primary-foreground, white);
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

.psfa-compare-toast.psfa-toast-error {
    border-color: #fecaca;
}

.psfa-compare-toast.psfa-toast-error::before {
    content: '✕';
    background: #ef4444;
}

.psfa-compare-toast.psfa-toast-out {
    animation: psfa-toast-out 0.3s ease-out forwards;
}

@keyframes psfa-toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes psfa-toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Ensure product cards have relative positioning */
.psfa-product,
.psfa-product-card {
    position: relative;
}
