/**
 * Hala Custom Plugin - Styles
 *
 * Professional PayLater widget with modal
 */

.hala-paylater-widget {
    margin: 8px 0;
}

.hala-paylater-trigger {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.installment-accodian {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px 14px;
    background-color: #ffffff;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.installment-accodian:hover {
    border-color: #4CAF50;
    box-shadow: 0 6px 18px rgba(76, 175, 80, 0.12);
}

.installment-accodian--wrapper {
    display: contents;
}

.installment-method {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.installment-method p {
    margin: 0;
    padding: 0;
    line-height: 1.3;
}

.installment-method .fw-600 {
    font-weight: 700;
    font-size: 13px;
    color: #1f2933;
}

.installment-method--info {
    font-size: 12px;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 6px;
}

.installment-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.radio__icon--installment {
    width: 40px;
    height: 26px;
    background-color: #fff;
    border-radius: 6px;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.radio__icon--installment img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.d-flex { display: flex !important; }
.align-center { align-items: center !important; }

.icon--base {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon--base img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ml4 { margin-left: 4px !important; }
.fs-12 { font-size: 12px !important; }
.fw-600 { font-weight: 600 !important; }

.price__alignment {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
}

.price__currency { margin-right: 2px; }

.price__label b {
    font-size: 14px;
    font-weight: 700;
    color: #4CAF50;
}

.muted { color: #6b7280; font-size: 12px; }

/* Modal styles */
.hala-paylater-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 99999;
}

.hala-paylater-modal.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.hala-paylater-modal__overlay {
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: auto;
}

.hala-paylater-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 20px 24px;
    width: min(520px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    z-index: 1;
}

.hala-paylater-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: #f1f3f5;
    color: #111;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

.hala-paylater-modal__body { display: grid; gap: 16px; }

.hala-paylater-modal__header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
}

.modal-logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.modal-title { font-size: 18px; font-weight: 700; color: #1f2933; }
.modal-subtitle { font-size: 14px; color: #4b5563; }

.modal-section h4 {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 700;
    color: #1f2933;
}

.modal-list {
    margin: 0 0 4px 18px;
    padding: 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

body.hala-modal-open { overflow: hidden; }

/* Responsive styles for mobile */
@media (max-width: 768px) {
    .installment-accodian { padding: 8px 10px; gap: 8px; }
    .installment-method .fw-600 { font-size: 12px; }
    .installment-method--info { font-size: 11px; }
    .price__label b { font-size: 13px; }
    .radio__icon--installment { width: 34px; height: 22px; }
    .hala-paylater-modal__dialog { width: 94vw; padding: 18px 16px; }
}

/* In-store availability block */
.hala-store-avail-block { margin-top: 12px; }
.hala-branch-availability { margin-top: 12px; }
.hala-store-last-sync { margin-top: 6px; font-size: 12px; color: #4b5563; }

.sm-in-store-avail-btn { margin: 6px 0; }

.hala-store-availability-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    color: #111827;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, transform 0.12s ease;
}

.hala-store-availability-button img { width: 22px; height: 22px; }

.hala-store-availability-button:hover {
    border-color: #4CAF50;
    background: #f3fff5;
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.14);
    transform: translateY(-1px);
}

.hala-store-availability-button__left {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.hala-store-availability-button__right {
    font-size: 18px;
    line-height: 1;
    color: #4CAF50;
    font-weight: 800;
}

.hala-branch-stock-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #1f2933;
}

.hala-branch-stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
}

.hala-branch-name { font-weight: 600; }
.hala-branch-status { color: #4b5563; }

/* Store availability modal */
.hala-store-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 99999;
}

.hala-store-modal.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.hala-store-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    pointer-events: auto;
}

.hala-store-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 20px 22px;
    width: min(720px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    z-index: 1;
}

.hala-store-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    border: none;
    background: #f1f3f5;
    color: #111;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
    z-index: 2;
}
.hala-store-modal__close:hover { background: #e2e8f0; }

.hala-store-modal__body { display: grid; gap: 14px; }

.hala-store-modal__header { display: flex; align-items: flex-start; width: 100%; padding-right: 40px; }
.hala-store-modal__title { font-size: 18px; font-weight: 800; color: #111827; }
.hala-store-modal__notice { font-size: 13px; color: #4b5563; }

.hala-store-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 14px;
    background: #f9fafb;
    display: grid;
    gap: 8px;
}

.hala-store-card__title { font-weight: 800; font-size: 14px; color: #111827; }
.hala-store-card__row { display: flex; gap: 8px; align-items: flex-start; color: #374151; font-size: 13px; }
.hala-store-card__icon { width: 18px; text-align: center; }
.hala-store-card__actions a { color: #2563eb; text-decoration: none; font-weight: 600; }
.hala-store-card__actions a:hover { text-decoration: underline; }

.hala-store-modal__alert {
    background: #fff8e6;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    padding: 12px 14px;
    color: #92400e;
    font-size: 13px;
}
