/* ──────────────────────────────────────────────────────────────────────────
   WhatsApp Order Slip Generator — Trade Tools
   High-density, minimal-space, mobile-first design with WhatsApp fidelity.
   ────────────────────────────────────────────────────────────────────────── */

/* Segmented Buttons & Language Selector ---------------------------------- */
.wos-lang-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.10);
    color: #52525b;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s ease;
}

html.dark .wos-lang-btn {
    background: rgba(24, 24, 27, 0.8);
    border-color: rgba(255, 255, 255, 0.10);
    color: #a1a1aa;
}

.wos-lang-btn:hover {
    border-color: rgba(245, 158, 11, 0.45);
    color: #b45309;
}

html.dark .wos-lang-btn:hover {
    color: #fbbf24;
}

.wos-lang-btn.is-active {
    background: #f59e0b !important;
    border-color: transparent !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

/* Toggle Tabs for Preview / Edit ----------------------------------------- */
.wos-tab-btn {
    color: #71717a;
    transition: all 0.15s ease;
}

html.dark .wos-tab-btn {
    color: #a1a1aa;
}

.wos-tab-btn.is-active {
    background: #ffffff;
    color: #18181b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

html.dark .wos-tab-btn.is-active {
    background: #27272a;
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Chat Surface & WhatsApp Bubble ----------------------------------------- */
.wos-chat {
    background-color: #efeae2;
    background-image:
        radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

html.dark .wos-chat {
    background-color: #0b141a;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    border-color: rgba(255, 255, 255, 0.08);
}

.wos-bubble {
    position: relative;
    max-width: 100%;
    margin-left: auto;
    background: #d9fdd3;
    color: #111b21;
    border-radius: 12px 2px 12px 12px;
    padding: 10px 12px 6px;
    box-shadow: 0 1px 2px rgba(11, 20, 26, 0.15);
}

html.dark .wos-bubble {
    background: #005c4b;
    color: #e9edef;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* The tail on the top-right corner of the bubble */
.wos-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    right: -7px;
    width: 8px;
    height: 13px;
    background: #d9fdd3;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}

html.dark .wos-bubble::after {
    background: #005c4b;
}

.wos-bubble-text {
    font-size: 13px;
    line-height: 1.48;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wos-bubble-line {
    min-height: 1.48em;
}

.wos-bubble-text strong {
    font-weight: 700;
}

.wos-bubble-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    font-size: 10.5px;
    color: #667781;
}

html.dark .wos-bubble-meta {
    color: #8696a0;
}

.wos-bubble-meta i {
    color: #53bdeb;
    font-size: 11px;
}

/* Line-item rows (Apple iOS Inset Row & Connected Capsules) ----------- */
#wos-rows {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 4px 12px rgba(0, 0, 0, 0.02);
}

.wos-row {
    transition: background-color 0.15s ease;
    -webkit-font-smoothing: antialiased;
}

.wos-row.is-incomplete {
    opacity: 0.75;
}

.wos-row .wos-line-total {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Custom compact select arrow & capsule styling */
.wos-unit {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2371717a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 9px 9px;
    padding-right: 16px !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Add-on Accordion / Pill States ------------------------------------------ */
.wos-addon-pill {
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.wos-addon-pill.is-active {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.5);
    color: #b45309;
}

html.dark .wos-addon-pill.is-active {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.6);
    color: #fbbf24;
}

/* Extra Advance Handling -------------------------------------------------- */
html:not(.dark) .wos-tile.is-extra {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
}

html.dark .wos-tile.is-extra {
    background: rgba(59, 130, 246, 0.12) !important;
    border-color: rgba(59, 130, 246, 0.35) !important;
}

html:not(.dark) .wos-tile.is-extra .wos-tile-label,
html:not(.dark) .wos-tile.is-extra .wos-tile-value {
    color: #1d4ed8 !important;
}

html.dark .wos-tile.is-extra .wos-tile-label,
html.dark .wos-tile.is-extra .wos-tile-value {
    color: #93c5fd !important;
}

/* Action Button Styles & Correct Contrasts -------------------------------- */
.wos-btn-wa {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

.wos-btn-wa:hover {
    filter: brightness(1.08);
}

/* WhatsApp CTA text colors */
#wos-whatsapp-btn,
#wos-whatsapp-btn span,
#wos-whatsapp-btn i,
#wos-mobile-wa-btn,
#wos-mobile-wa-btn span,
#wos-mobile-wa-btn i {
    color: #ffffff !important;
}

/* Copy Button: solid dark in light mode, solid white in dark mode */
html:not(.dark) #wos-copy-btn {
    background-color: #18181b !important;
    color: #ffffff !important;
}
html:not(.dark) #wos-copy-btn span,
html:not(.dark) #wos-copy-btn i {
    color: #ffffff !important;
}

html.dark #wos-copy-btn {
    background-color: #ffffff !important;
    color: #18181b !important;
}
html.dark #wos-copy-btn span,
html.dark #wos-copy-btn i {
    color: #18181b !important;
}

/* Share Button: clean neutral button with clear contrast */
html:not(.dark) #wos-share-btn {
    background-color: #f4f4f5 !important;
    border-color: #e4e4e7 !important;
    color: #18181b !important;
}
html:not(.dark) #wos-share-btn span,
html:not(.dark) #wos-share-btn i {
    color: #18181b !important;
}

html.dark #wos-share-btn {
    background-color: #27272a !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #f4f4f5 !important;
}
html.dark #wos-share-btn span,
html.dark #wos-share-btn i {
    color: #f4f4f5 !important;
}

/* Save Image Button: warm amber styling */
html:not(.dark) #wos-image-btn {
    background-color: rgba(245, 158, 11, 0.12) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
    color: #b45309 !important;
}
html:not(.dark) #wos-image-btn span,
html:not(.dark) #wos-image-btn i {
    color: #b45309 !important;
}

html.dark #wos-image-btn {
    background-color: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
    color: #fbbf24 !important;
}
html.dark #wos-image-btn span,
html.dark #wos-image-btn i {
    color: #fbbf24 !important;
}

/* Review / Check button */
html:not(.dark) #wos-review-btn {
    background-color: #f4f4f5 !important;
    border-color: #e4e4e7 !important;
    color: #3f3f46 !important;
}
html:not(.dark) #wos-review-btn span,
html:not(.dark) #wos-review-btn i {
    color: #3f3f46 !important;
}

html.dark #wos-review-btn {
    background-color: #27272a !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #d4d4d8 !important;
}
html.dark #wos-review-btn span,
html.dark #wos-review-btn i {
    color: #d4d4d8 !important;
}

/* Mobile buttons contrast */
html:not(.dark) #wos-mobile-copy-btn {
    background-color: #f4f4f5 !important;
    color: #18181b !important;
    border-color: #d4d4d8 !important;
}
html:not(.dark) #wos-mobile-copy-btn span,
html:not(.dark) #wos-mobile-copy-btn i {
    color: #18181b !important;
}

/* Focus and input styling ------------------------------------------------- */
.wos-money::-webkit-outer-spin-button,
.wos-money::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.wos-money {
    -moz-appearance: textfield;
}

/* Focus outlines */
.wos-lang-btn:focus-visible,
.wos-tab-btn:focus-visible,
.wos-remove:focus-visible,
#wos-add-item:focus-visible {
    outline: 2px solid #f59e0b;
    outline-offset: 2px;
}

/* Disabled State */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Print/Export Template styles */
#wos-export-card {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Phone: items as a tight list, not stacked cards */
@media (max-width: 639px) {
    #wos-input-card {
        padding: 0.65rem !important;
    }

    #wos-input-card.space-y-3 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0.65rem;
    }

    #wos-rows.space-y-2 > :not([hidden]) ~ :not([hidden]),
    #wos-rows.space-y-0 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0 !important;
    }

    [data-i18n="hint.itemsRequired"] {
        display: none;
    }

    .wos-row .wos-remove {
        background: transparent !important;
        color: #c4c4cc;
    }
}
