/* =====================================================
   EC Reservation System
   ===================================================== */

/* --- Product / cart timer --- */
.ec-res-timer {
    display: block;
    padding: 6px 12px;
    background: rgba(8,145,178,.08);
    border: 1px solid rgba(8,145,178,.3);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #0e7490;
    margin: 0 0 10px;
    width: fit-content;
}
.ec-res-timer.ec-res-timer-urgent {
    background: rgba(220,38,38,.08);
    border-color: rgba(220,38,38,.35);
    color: #dc2626;
    animation: ec-res-pulse 1s ease-in-out infinite;
}
.ec-res-timer.ec-res-timer-expired {
    background: rgba(107,114,128,.08);
    border-color: rgba(107,114,128,.3);
    color: #6b7280;
}
@keyframes ec-res-pulse {
    0%,100% { opacity:1; }
    50%      { opacity:.65; }
}

/* --- Cart expiry banner --- */
.ec-res-cart-expiry-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(245,158,11,.1);
    border: 1px solid rgba(245,158,11,.45);
    border-radius: 6px;
    font-size: 14px;
    color: #92400e;
    margin-bottom: 16px;
}

/* --- Conflict notice --- */
.ec-res-conflict-notice {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(239,68,68,.06);
    border: 1px solid rgba(239,68,68,.3);
    border-left: 4px solid #ef4444;
    border-radius: 4px;
    font-size: 13px;
    color: #991b1b;
    margin-bottom: 12px;
}
.ec-res-conflict-notice.is-visible { display: flex; }


/* --- Popup overlay --- */
.ec-res-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.ec-res-popup-overlay.is-visible { display: flex; }

.ec-res-popup-box {
    background: #fff;
    border-radius: 10px;
    padding: 28px 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.22);
}
.ec-res-popup-box h3 {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
}
.ec-res-popup-box p {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.65;
    color: #374151;
}
.ec-res-popup-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Buttons */
.ec-res-btn-primary,
.ec-res-btn-primary:visited {
    display: inline-block;
    padding: 10px 20px;
    background: #0891b2;
    color: #fff !important;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
}
.ec-res-btn-primary:hover { background: #0e7490; }
.ec-res-btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.ec-res-btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    background: #f3f4f6;
    color: #374151 !important;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s;
}
.ec-res-btn-secondary:hover { background: #e5e7eb; }

.ec-res-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

/* =====================================================
   Admin styles
   ===================================================== */
.ec-res-admin-wrap { max-width: 1200px; }

.ec-res-tab-content { padding-top: 20px; }

.ec-res-settings-table .ec-res-category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 12px;
    border-radius: 4px;
    background: #fafafa;
}
.ec-res-cat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}
.ec-res-cat-count { color: #6b7280; font-size: 11px; }

/* Dashboard header */
.ec-res-dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 12px;
    flex-wrap: wrap;
    gap: 12px;
}
.ec-res-dashboard-header h2 { margin: 0; }
.ec-res-total-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0891b2;
    color: #fff;
    border-radius: 999px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 6px;
    vertical-align: middle;
}
.ec-res-dashboard-controls { display: flex; align-items: center; gap: 10px; }

/* Dashboard table row states */
.ec-res-dashboard-table .ec-res-row-warning td { background: rgba(245,158,11,.05) !important; }
.ec-res-dashboard-table .ec-res-row-urgent td  { background: rgba(239,68,68,.05) !important; }
.ec-res-dashboard-table .ec-res-row-expired td { opacity: .5; }

/* Pagination */
.ec-res-pagination { padding: 10px 0; }
.ec-res-pagination a,
.ec-res-pagination .current {
    display: inline-block;
    padding: 4px 9px;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    text-decoration: none;
}
.ec-res-pagination .current {
    background: #0891b2;
    color: #fff;
    border-color: #0891b2;
}

/* Empty state */
.ec-res-empty-state {
    padding: 40px;
    text-align: center;
    color: #6b7280;
    background: #fafafa;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    margin-top: 16px;
}

/* Mobile */
@media (max-width: 600px) {
    .ec-res-popup-box { padding: 20px; }
    .ec-res-popup-box h3 { font-size: 16px; }
    .ec-res-popup-actions { flex-direction: column; }
    .ec-res-btn-primary,
    .ec-res-btn-secondary { width: 100%; text-align: center; }
}

/* --- Loop reserved badge (catalog / shop / category pages) --- */
.ec-res-reserved-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.3);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #dc2626;
    margin: 4px 0 6px;
}

/* --- Single product reserved notice --- */
.ec-res-unavailable-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(239,68,68,.06);
    border: 1px solid rgba(239,68,68,.3);
    border-left: 4px solid #ef4444;
    border-radius: 4px;
    font-size: 14px;
    color: #991b1b;
    margin: 0 0 16px;
}

/* ---- In-cart / Reserved loop button states ---- */
.ec-res-in-cart-btn {
    display: inline-flex !important;
    background-color: #43a047 !important;
    color: #fff !important;
    border-color: #43a047 !important;
    cursor: pointer;
}
.ec-res-in-cart-btn:hover {
    background-color: #2e7d32 !important;
    border-color: #2e7d32 !important;
    color: #fff !important;
}
.ec-res-reserved-btn {
    background-color: #e0e0e0 !important;
    color: #757575 !important;
    border-color: #bdbdbd !important;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Cart timer: force onto new line under product name --- */
td.product-name .ec-res-timer {
    display: block;
    margin-top: 6px;
    margin-bottom: 0;
}

/* --- Empty cart button --- */
.ec-res-empty-cart-btn.button {
    background: transparent;
    color: #dc2626 !important;
    border: 2px solid #dc2626;
    margin-left: 8px;
    transition: background .2s, color .2s;
}
.ec-res-empty-cart-btn.button:hover {
    background: #dc2626;
    color: #fff !important;
    border-color: #dc2626;
}

/* --- Responsive: Smartphones (all smartphones, max 767px) --- */
@media (max-width: 767px) {
    .ec-res-timer {
        padding: 2px 2px;
        font-size: 66%;
    }
    .box-text.text-center {
        padding-left: 2px;
        padding-right: 2px;
    }
}

/* --- Responsive: Tablets horizontal (800px–1024px landscape) --- */
@media (min-width: 800px) and (max-width: 1024px) {
    .ec-res-timer {
        padding: 3px 3px;
        font-size: 60%;
    }
    .box-text.text-center {
        padding-left: 2px;
        padding-right: 2px;
    }
}

/* --- Responsive: Tablets vertical (1156px–1366px portrait) --- */
@media (min-width: 1156px) and (max-width: 1366px) {
    .ec-res-timer {
        padding: 3px 3px;
        font-size: 70%;
    }
    .box-text.text-center {
        padding-left: 2px;
        padding-right: 2px;
    }
}

/* --- Mini cart per-item timer --- */
.ec-res-minicart-timer {
    display: block;
    padding: 3px 8px;
    background: rgba(8,145,178,.08);
    border: 1px solid rgba(8,145,178,.3);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #0e7490;
    margin-top: 4px;
    width: fit-content;
    white-space: nowrap;
}
.ec-res-minicart-timer.ec-res-timer-urgent {
    background: rgba(220,38,38,.08);
    border-color: rgba(220,38,38,.35);
    color: #dc2626;
    animation: ec-res-pulse 1s ease-in-out infinite;
}
.ec-res-minicart-timer.ec-res-timer-expired {
    background: rgba(107,114,128,.08);
    border-color: rgba(107,114,128,.3);
    color: #6b7280;
    animation: none;
}

/* --- Mini cart expiry notice --- */
.ec-res-minicart-expiry {
    display: block;
    padding: 6px 12px;
    background: rgba(245,158,11,.1);
    border-bottom: 1px solid rgba(245,158,11,.45);
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    text-align: center;
    margin-bottom: 6px;
}

/* --- Single product page timer --- */
.single-product .ec-res-timer {
    display: block;
    justify-content: center;
    align-items: center;
    text-align: center;
    max-width: 200px;
}

/* ============================================================
   REMINDER POPUP IMPROVEMENTS
   ============================================================ */

/* Entrance animation */
@keyframes ecResPopupSlideIn {
    from { opacity: 0; transform: translateY(-18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)     scale(1);    }
}
.ec-res-popup-animate {
    animation: ecResPopupSlideIn 0.28s ease-out both;
}

/* Top accent bar */
.ec-res-popup-accent-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 12px 12px 0 0;
    background: #f59e0b;
    transition: background 0.4s ease;
}
.ec-res-popup-box.ec-res-timer-urgent .ec-res-popup-accent-bar {
    background: #dc2626;
}

/* X close button */
.ec-res-popup-close {
    position: absolute;
    top: 4px; right: 0px;
    margin-right: 0px !important;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.ec-res-popup-close:hover {
    color: #111827;
    background: #f3f4f6;
}

/* Hero countdown */
.ec-res-popup-hero-countdown {
    text-align: center;
    margin: 14px 0 10px;
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #f59e0b;
    transition: color 0.4s ease;
    line-height: 1;
}
.ec-res-popup-hero-countdown.ec-res-timer-urgent {
    color: #dc2626;
    animation: ecResPulse 0.9s ease-in-out infinite;
}

/* Urgent pulse */
@keyframes ecResPulse {
    0%, 100% { opacity: 1;    transform: scale(1);    }
    50%       { opacity: 0.8; transform: scale(1.04); }
}

/* Box urgent border tint */
.ec-res-popup-box.ec-res-timer-urgent {
    border-color: #fca5a5;
}

/* ============================================================
   POPUP V3 — RADIUS, CENTERING, BUTTON STYLES
   ============================================================ */

/* Fully square popup box */
.ec-res-popup-box {
    border-radius: 0 !important;
    text-align: center;
}

/* Square accent bar */
.ec-res-popup-accent-bar {
    border-radius: 0 !important;
}

/* Square close button */
.ec-res-popup-close {
    border-radius: 0 !important;
}

/* Center popup text content */
.ec-res-popup-box h3,
.ec-res-popup-box p {
    text-align: center;
}

/* Center action buttons row */
.ec-res-popup-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

/* Primary button — Secure My Coral */
.ec-res-btn-primary {
    display: inline-block;
    width: 100%;
    max-width: 320px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    border-radius: 0 !important;
    cursor: pointer;
    box-sizing: border-box;
}

/* Secondary button — Skip for now */
.ec-res-btn-secondary {
    display: inline-block;
    width: 100%;
    max-width: 320px;
    padding: 10px 24px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-align: center;
    border-radius: 0 !important;
    cursor: pointer;
    box-sizing: border-box;
}

/* V3 patch — secondary button margin */
.ec-res-btn-secondary {
    margin-right: 0px;
}

/* --- Timer spacing fix --- */
.ec-res-timer .ec-res-timer-icon { margin-right: 0.25em; }
.single-product .ec-res-timer .ec-res-timer-label { margin-right: 0.25em; }
