/**
 * Pronova Local Delivery — frontend styles
 *
 * Designed to match the visual language of WC Stock Status Pro (wcsp-*) so
 * the delivery panel feels like a natural continuation of the stock status block.
 *
 * Colour palette (mirrors WCSP):
 *   Green  #2e7d32  — collection / courier / in-range (mirrors WCSP)
 *   Blue   #1565c0  — local bakkie only / informational
 *   Orange #e65100  — special bakkie / attention
 *   Grey   #546e7a  — neutral / secondary
 */

/* ── Delivery panel wrapper ─────────────────────────────────────────────────── */

.pld-delivery-panel {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0.5em 0 0.75em;
    font-size: 0.9em;
}

/* ── Individual delivery lines ─────────────────────────────────────────────── */

.pld-delivery-line {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.45;
    padding: 0;
}

.pld-icon {
    flex-shrink: 0;
    font-size: 1em;
    line-height: 1.45;
}

/* Standard courier: green */
.pld-standard {
    color: #2e7d32;
}

/* Special delivery: orange */
.pld-special {
    color: #e65100;
}

/* Collection: always green — matches WCSP in-stock status colour.
   Parent selector + !important ensures this wins over any theme or
   plugin rule that may also target .pld-collection. */
.pld-delivery-panel .pld-collection,
.pld-delivery-panel .pld-collection strong {
    color: #2e7d32 !important;
}
.pld-delivery-panel .pld-collection small {
    display: block;
    color: #4a7c59;
    margin-top: 2px;
    font-size: 0.85em;
}

/* Rate preview line */
.pld-rate-preview {
    color: #37474f;
    font-style: italic;
}

.pld-rate-known {
    font-style: normal;
    color: #1b5e20;
    font-weight: 500;
}

/* ── Courier delivery time frame accordion ─────────────────────────────────── */

/* Block-level so it sits on its own line; don't use inline-block (breaks Firefox) */
.pld-timeframe-accordion {
    display: block;
    margin-top: 3px;
    margin-left: 22px; /* indent to align with the text after the icon */
}

/* Hide the browser's built-in disclosure triangle in all browsers */
.pld-timeframe-accordion > summary {
    list-style: none; /* Firefox */
}
.pld-timeframe-accordion > summary::-webkit-details-marker {
    display: none;    /* Chrome / Safari */
}

.pld-timeframe-accordion summary {
    cursor: pointer;
    font-size: 0.85em;
    color: #1565c0;
    display: flex;
    align-items: center;
    gap: 5px;
    user-select: none;
    width: fit-content;
}

.pld-timeframe-accordion summary .pld-accordion-arrow {
    display: inline-block;
    font-size: 0.65em;
    transition: transform 0.15s ease;
    line-height: 1;
}

.pld-timeframe-accordion[open] summary .pld-accordion-arrow {
    transform: rotate(90deg);
}

.pld-timeframe-accordion summary:hover {
    color: #0d47a1;
    text-decoration: underline;
}

.pld-timeframe-accordion summary:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: 2px;
    border-radius: 2px;
}

.pld-timeframe-body {
    margin-top: 5px;
    padding: 6px 10px;
    background: #f1f8f1;
    border-left: 3px solid #2e7d32;
    border-radius: 0 3px 3px 0;
    font-size: 0.9em;
    color: #2e7d32;
    line-height: 1.5;
}

/* ── Loading spinner for live rate updates ─────────────────────────────────── */

.pld-rate-loading .pld-rate-text::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 6px;
    border: 2px solid #ccc;
    border-top-color: #546e7a;
    border-radius: 50%;
    animation: pld-spin 0.7s linear infinite;
    vertical-align: middle;
}

@keyframes pld-spin {
    to { transform: rotate(360deg); }
}

/* ── Out-of-range message ───────────────────────────────────────────────────── */

.pld-out-of-range {
    color: #b71c1c;
}

/* ── Checkout notice for collection-only ────────────────────────────────────── */

.woocommerce-info.pld-collection-notice {
    border-top-color: #2e7d32;
}

/* ── Admin order panel ──────────────────────────────────────────────────────── */

.pld-order-delivery-panel h4 {
    font-size: 13px !important;
}

.pld-order-delivery-panel details summary {
    cursor: pointer;
    outline: none;
}

.pld-order-delivery-panel details summary:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ── Products list column colour dots ──────────────────────────────────────── */

#the-list td[class*='pld_delivery_type'] span {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.82em;
}

/* ── Dark mode compatibility ────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
    .pld-collection small {
        color: #81c784;
    }
    .pld-rate-preview {
        color: #90a4ae;
    }
    .pld-timeframe-body {
        background: #1b2d1b;
        color: #81c784;
    }
}
