/* ==========================================================
   Capture Memories – WooCommerce Product Page Styles
   All classes prefixed with cm-woo- to avoid theme conflicts.
   ========================================================== */

/* ---------- Photobooth Button ---------- */

.cm-woo-photobooth-wrap {
    margin: 12px 0;
    display: inline-block;
    width: 100%;
}

.cm-woo-photobooth-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #ff69b4, #ff1493);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 105, 180, 0.35);
    line-height: 1.4;
    font-family: inherit;
}

.cm-woo-photobooth-btn:hover {
    background: linear-gradient(135deg, #ff1493, #c71585);
    box-shadow: 0 4px 16px rgba(255, 20, 147, 0.45);
    transform: translateY(-1px);
}

.cm-woo-photobooth-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(255, 20, 147, 0.3);
}

.cm-woo-photobooth-btn:focus-visible {
    outline: 3px solid rgba(255, 105, 180, 0.5);
    outline-offset: 2px;
}

.cm-woo-btn-icon {
    display: flex;
    align-items: center;
}

.cm-woo-btn-icon svg {
    flex-shrink: 0;
}

/* ---------- Popup Overlay ---------- */

.cm-woo-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: cmWooFadeIn 0.25s ease;
}

@keyframes cmWooFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---------- Popup Container ---------- */

.cm-woo-popup-container {
    position: relative;
    background: #fff;
    border-radius: 16px;
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    animation: cmWooSlideUp 0.3s ease;
}

@keyframes cmWooSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ---------- Close Button ---------- */

.cm-woo-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background 0.2s ease;
    padding: 0;
    font-family: inherit;
}

.cm-woo-popup-close:hover {
    background: rgba(0, 0, 0, 0.75);
}

.cm-woo-popup-close:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

/* ---------- Popup Body ---------- */

.cm-woo-popup-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* ---------- Loading Spinner ---------- */

.cm-woo-popup-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.cm-woo-popup-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #ff69b4;
    border-radius: 50%;
    animation: cmWooSpin 0.8s linear infinite;
}

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

/* ---------- Banner Image ---------- */

.cm-woo-popup-banner {
    width: 100%;
}

.cm-woo-popup-banner img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
}

/* ---------- Empty State ---------- */

.cm-woo-popup-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.cm-woo-popup-empty-icon {
    display: block;
    margin-bottom: 12px;
    color: #ccc;
}

.cm-woo-popup-empty p {
    margin: 0;
    font-size: 15px;
}

/* ---------- Admin: WooCommerce Settings Page ---------- */

.cm-woo-form .form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
}

.cm-woo-form .form-table td {
    padding: 15px 10px;
}

/* Toggle switch */
.cm-woo-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    vertical-align: middle;
}

.cm-woo-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cm-woo-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 26px;
    transition: 0.3s;
}

.cm-woo-toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.cm-woo-toggle input:checked + .cm-woo-toggle-slider {
    background: #4CAF50;
}

.cm-woo-toggle input:checked + .cm-woo-toggle-slider::before {
    transform: translateX(24px);
}

.cm-woo-toggle input:focus-visible + .cm-woo-toggle-slider {
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

/* Banner preview */
.cm-woo-banner-preview {
    width: 100%;
    max-width: 400px;
    min-height: 120px;
    border: 2px dashed #ddd;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    background: #f9f9f9;
    overflow: hidden;
}

.cm-woo-banner-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.cm-woo-banner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #aaa;
    font-size: 13px;
    padding: 20px;
}

.cm-woo-banner-placeholder .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
    color: #ccc;
}

.cm-woo-banner-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.cm-woo-banner-actions .dashicons {
    vertical-align: middle;
    margin-top: -2px;
}

.cm-woo-save-status {
    margin-left: 12px;
    font-weight: 500;
    font-size: 14px;
}

/* Per-tag banners grid */
.cm-woo-tag-banners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.cm-woo-tag-banner-card {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 16px;
    background: #fafafa;
    transition: box-shadow 0.2s ease;
}

.cm-woo-tag-banner-card:hover {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.cm-woo-tag-banner-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 14px;
}

.cm-woo-tag-banner-header .dashicons {
    color: #2271b1;
}

.cm-woo-tag-count {
    margin-left: auto;
    font-size: 12px;
    color: #888;
}

.cm-woo-tag-banner-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cm-woo-tag-banner-thumb {
    width: 100%;
    height: 100px;
    border: 1px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
}

.cm-woo-tag-banner-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cm-woo-tag-placeholder .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #ccc;
}

.cm-woo-tag-banner-btns {
    display: flex;
    gap: 6px;
}

.cm-woo-tag-banner-status {
    text-align: center;
    margin-top: 4px;
    font-size: 11px;
}

.cm-woo-status-active {
    color: #4CAF50;
    font-weight: 500;
}

.cm-woo-status-default {
    color: #999;
}

.cm-woo-no-tags {
    color: #888;
    font-style: italic;
    padding: 20px 0;
}

/* Admin: Tag search dropdown */
.cm-tag-search-wrap {
    position: relative;
}

.cm-tag-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #8c8f94;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    max-height: 220px;
    overflow-y: auto;
    z-index: 1000;
}

.cm-tag-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    transition: background 0.15s;
    border-bottom: 1px solid #f0f0f0;
}

.cm-tag-dropdown-item:last-child {
    border-bottom: none;
}

.cm-tag-dropdown-item:hover {
    background: #f0f6fc;
}

.cm-tag-dropdown-slug {
    color: #888;
    font-size: 12px;
}

.cm-tag-dropdown-count {
    margin-left: auto;
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}

.cm-tag-no-results {
    color: #888;
    font-style: italic;
    cursor: default;
}

.cm-tag-no-results:hover {
    background: transparent;
}

/* Admin: Tag banner inline on general page */
.cm-tag-banner-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid #eee;
    margin-top: 8px;
}

.cm-tag-banner-thumb-inline {
    width: 48px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    flex-shrink: 0;
}

.cm-tag-banner-thumb-inline img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.cm-tag-banner-empty .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #ccc;
}

.cm-tag-banner-inline-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cm-tag-banner-inline-btns .button {
    padding: 2px 6px;
    min-height: 28px;
}

.cm-tag-banner-inline-btns .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.cm-tag-banner-label {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
    .cm-woo-popup-container {
        max-width: 95vw;
        border-radius: 12px;
    }

    .cm-woo-popup-banner img {
        border-radius: 12px;
    }

    .cm-woo-photobooth-btn {
        font-size: 14px;
        padding: 10px 18px;
    }

    .cm-woo-tag-banners-grid {
        grid-template-columns: 1fr;
    }

    .cm-tag-banner-section {
        flex-wrap: wrap;
    }
}
