/**
 * Compare Posts Styles
 *
 * Styles for compare badge, popup, and comparison table
 *
 * @package Voxel_Toolkit
 */

/* ========================================
   Compare Badge (Vertical Side Badge)
   ======================================== */
.vt-compare-badge {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    background: var(--ts-accent-1, #3b82f6);
    color: #fff;
    padding: 15px 10px;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.vt-compare-badge:hover {
    transform: translateY(-50%) translateX(-2px);
}

.vt-badge-count {
    writing-mode: horizontal-tb;
    background: #fff;
    color: var(--ts-accent-1, #3b82f6);
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

/* ========================================
   Compare Popup - Desktop (Slide from right)
   ======================================== */
.vt-compare-popup-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 500000;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.vt-compare-popup,
.vt-compare-popup.ts-field-popup {
    width: 320px !important;
    max-width: 320px !important;
    min-width: 320px !important;
    max-height: 70vh;
    background: #fff;
    border-radius: 12px 0 0 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.vt-compare-popup-overlay.is-open .vt-compare-popup {
    transform: translateX(0);
}

/* Constrain the container wrapper */
.vt-compare-popup-overlay .ts-field-popup-container {
    width: auto !important;
    max-width: 320px !important;
}

.vt-compare-popup .ts-popup-head {
    padding: 15px 20px;
    border-bottom: 1px solid var(--ts-shade-5, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vt-compare-popup .ts-popup-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--ts-shade-1, #111827);
}

.vt-compare-popup .vt-compare-popup-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--ts-shade-3, #6b7280);
    transition: background 0.2s ease, color 0.2s ease;
    text-decoration: none;
}

.vt-compare-popup .vt-compare-popup-close:hover {
    background: var(--ts-shade-5, #f3f4f6);
    color: var(--ts-shade-1, #111827);
}

.vt-compare-popup .ts-popup-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.vt-compare-popup-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.vt-compare-popup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--ts-shade-5, #e5e7eb);
}

.vt-compare-popup-item:last-child {
    border-bottom: none;
}

.vt-popup-post-title {
    font-size: 14px;
    color: var(--ts-shade-1, #111827);
    flex: 1;
    padding-right: 10px;
}

.vt-popup-remove-post {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--ts-shade-3, #6b7280);
    transition: background 0.2s ease, color 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.vt-popup-remove-post:hover {
    background: #fee2e2;
    color: #ef4444;
}

.vt-compare-popup-empty {
    padding: 30px 20px;
    text-align: center;
    color: var(--ts-shade-3, #6b7280);
    font-size: 14px;
}

.vt-compare-popup .ts-popup-controller {
    padding: 15px 20px;
    border-top: 1px solid var(--ts-shade-5, #e5e7eb);
}

.vt-compare-popup .ts-popup-controller ul {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.vt-compare-popup .ts-popup-controller li {
    flex: 1;
}

.vt-compare-popup .ts-popup-controller .ts-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.vt-compare-popup .ts-btn-1 {
    background: var(--ts-accent-1, #3b82f6);
    color: #fff;
}

.vt-compare-popup .ts-btn-1:hover {
    background: var(--ts-accent-2, #2563eb);
}

.vt-compare-popup .ts-btn-1.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.vt-compare-popup .ts-btn-4 {
    background: var(--ts-shade-5, #f3f4f6);
    color: var(--ts-shade-1, #111827);
}

.vt-compare-popup .ts-btn-4:hover {
    background: var(--ts-shade-4, #e5e7eb);
}

/* Body overflow when popup open */
body.vt-compare-popup-open {
    overflow: hidden;
}

/* ========================================
   Action Widget Integration
   ======================================== */
.vt-compare-action-btn.active .ts-initial {
    display: none;
}

.vt-compare-action-btn .ts-reveal {
    display: none;
}

.vt-compare-action-btn.active .ts-reveal {
    display: flex;
}

/* ========================================
   Print Button
   ======================================== */
.vt-compare-print-wrapper {
    margin-bottom: 15px;
}

.vt-compare-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--ts-accent-1, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.vt-compare-print-btn:hover {
    background-color: var(--ts-accent-2, #2563eb);
}

.vt-compare-print-btn:active {
    transform: scale(0.98);
}

.vt-compare-print-btn i,
.vt-compare-print-btn svg {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ========================================
   Comparison Table Widget
   ======================================== */
.vt-compare-table-wrapper {
    width: 100%;
}

.vt-compare-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.vt-compare-empty,
.vt-compare-min-posts {
    padding: 40px 20px;
    text-align: center;
    background-color: #f9f9f9;
    border-radius: 8px;
    color: #666;
    font-size: 15px;
}

.vt-compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.vt-compare-table th,
.vt-compare-table td {
    padding: 12px 16px;
    text-align: left;
    border: 1px solid #eee;
    vertical-align: middle;
}

.vt-compare-table thead th {
    background-color: #f5f5f5;
    font-weight: 600;
    font-size: 14px;
}

.vt-compare-table .vt-compare-field-header {
    width: 200px;
    min-width: 150px;
}

.vt-compare-table .vt-compare-post-header {
    min-width: 180px;
}

.vt-compare-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.vt-compare-header-content img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.vt-compare-no-thumb-table {
    width: 60px;
    height: 60px;
    background-color: #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vt-compare-no-thumb-table .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #999;
}

.vt-compare-header-title {
    font-weight: 600;
    text-align: center;
    color: inherit;
    text-decoration: none;
}

.vt-compare-header-title:hover {
    text-decoration: underline;
}

.vt-compare-remove-btn {
    font-size: 12px;
    color: #e74c3c;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    transition: opacity 0.2s ease;
}

.vt-compare-remove-btn:hover {
    opacity: 0.7;
}

.vt-compare-table tbody th {
    background-color: #fafafa;
    font-weight: 500;
    font-size: 14px;
}

.vt-compare-table tbody td {
    font-size: 14px;
}

.vt-compare-table tbody tr:nth-child(even) td,
.vt-compare-table tbody tr:nth-child(even) th {
    background-color: #fafafa;
}

.vt-compare-field-label {
    white-space: nowrap;
}

/* ========================================
   Field Value Styles
   ======================================== */
.vt-compare-empty-value {
    color: #999;
    font-style: italic;
}

.vt-compare-yes {
    color: #4CAF50;
    font-weight: 500;
}

.vt-compare-no {
    color: #999;
}

/* Location */
.vt-compare-location {
    line-height: 1.5;
}

.vt-compare-location .vt-loc-address {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.vt-compare-location .vt-loc-address .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #e74c3c;
    flex-shrink: 0;
    margin-top: 2px;
}

.vt-compare-location .vt-loc-coords {
    color: #999;
    margin-top: 4px;
}

/* Work Hours */
.vt-compare-work-hours {
    line-height: 1.6;
}

.vt-compare-work-hours .vt-wh-day {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
}

.vt-compare-work-hours .vt-wh-day:last-child {
    border-bottom: none;
}

.vt-compare-work-hours .vt-wh-day-name {
    font-weight: 500;
    min-width: 80px;
}

.vt-compare-work-hours .vt-wh-day-hours {
    text-align: right;
}

/* Images */
.vt-compare-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vt-compare-images img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

/* Files */
.vt-compare-files {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vt-compare-files .vt-compare-file {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #2271b1;
    text-decoration: none;
}

.vt-compare-files .vt-compare-file:hover {
    text-decoration: underline;
}

.vt-compare-files .vt-compare-file .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Repeater */
.vt-compare-repeater {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vt-compare-repeater .vt-rep-item {
    padding: 10px 12px;
    background-color: #f5f5f5;
    border-radius: 6px;
    font-size: 13px;
}

.vt-compare-repeater .vt-rep-item-header {
    font-weight: 600;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.vt-compare-repeater .vt-rep-item-fields {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vt-compare-repeater .vt-rep-field {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.vt-compare-repeater .vt-rep-field-label {
    font-weight: 500;
    color: #555;
}

.vt-compare-repeater .vt-rep-field-value {
    color: #333;
}

/* Recurring/Event Date */
.vt-compare-recurring-date {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vt-compare-recurring-date .vt-rd-event {
    padding: 10px 12px;
    background-color: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 4px;
}

.vt-compare-recurring-date .vt-rd-event:last-child {
    margin-bottom: 0;
}

.vt-compare-recurring-date .vt-rd-event-header {
    font-weight: 600;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.vt-compare-recurring-date .vt-rd-start,
.vt-compare-recurring-date .vt-rd-end,
.vt-compare-recurring-date .vt-rd-freq,
.vt-compare-recurring-date .vt-rd-until,
.vt-compare-recurring-date .vt-rd-multiday,
.vt-compare-recurring-date .vt-rd-allday {
    line-height: 1.6;
    font-size: 13px;
}

.vt-compare-recurring-date strong {
    color: #555;
}

/* Product */
.vt-compare-product {
    line-height: 1.6;
}

.vt-compare-product > div {
    margin-bottom: 4px;
}

.vt-compare-product > div:last-child {
    margin-bottom: 0;
}

/* Color */
.vt-compare-color {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    background-color: #f5f5f5;
    border-radius: 4px;
}

.vt-compare-color::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background-color: inherit;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ========================================
   Toast Notifications
   ======================================== */
.vt-compare-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    background-color: #333;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.vt-compare-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.vt-compare-toast-warning {
    background-color: #f39c12;
}

.vt-compare-toast-error {
    background-color: #e74c3c;
}

.vt-compare-toast-success {
    background-color: #27ae60;
}

/* ========================================
   Responsive Styles
   ======================================== */

/* Mobile: Full width bottom sheet style */
@media (max-width: 768px) {
    .vt-compare-popup-overlay {
        display: flex;
        align-items: flex-end;
        justify-content: center;
        padding: 0;
        background: rgba(0, 0, 0, 0.5);
    }

    .vt-compare-popup-overlay .ts-field-popup-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .vt-compare-popup,
    .vt-compare-popup.ts-field-popup {
        position: relative;
        top: auto;
        right: auto;
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        max-height: 80vh;
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
        transform: translateY(100%);
        opacity: 1;
    }

    .vt-compare-popup-overlay.is-open .vt-compare-popup {
        transform: translateY(0);
    }

    .vt-compare-table .vt-compare-field-header {
        min-width: 120px;
        width: 120px;
    }

    .vt-compare-header-content img {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .vt-compare-header-content img {
        width: 40px;
        height: 40px;
    }

    .vt-compare-table th,
    .vt-compare-table td {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .vt-compare-print-wrapper {
        display: none !important;
    }

    .vt-compare-remove-btn {
        display: none !important;
    }
}
