/**
 * lh-components.css — Component dùng chung: card, form, nút, alert, animation.
 *
 * Khối kết quả tạo link & danh sách sản phẩm nằm ở lh-product.css.
 * Token lấy từ lh-base.css — KHÔNG hard-code màu/kích thước ngoài token.
 */

/* ── Card ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--lh-bg);
    border: 1px solid var(--lh-border);
    border-radius: var(--lh-radius-xl);
    box-shadow: var(--lh-shadow-sm);
    padding: var(--lh-space-md);
    display: flex;
    flex-direction: column;
    gap: var(--lh-space-md);
}

/* ── Form ──────────────────────────────────────────────────────────────── */
.field {
    display: flex;
    flex-direction: column;
    gap: var(--lh-space-sm);
}

.field__label {
    display: flex;
    align-items: center;
    gap: var(--lh-space-sm);
    font-size: 13px;
    font-weight: 700;
    color: var(--lh-text-secondary);
}

/* font-size 16px: chặn iOS tự zoom khi focus input trong webview */
.form-control {
    width: 100%;
    min-height: 46px;
    padding: 0 var(--lh-space-md);
    font-family: var(--lh-font-body);
    font-size: 16px;
    font-weight: 500;
    color: var(--lh-text);
    background: var(--lh-bg);
    border: 1.5px solid var(--lh-border);
    border-radius: var(--lh-radius-lg);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
    color: var(--lh-text-muted);
    font-weight: 500;
}

.form-control:focus {
    border-color: var(--lh-primary);
    box-shadow: 0 0 0 3px rgba(238, 77, 45, 0.12);
}

select.form-control {
    min-height: 38px;
    padding: 0 26px 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--lh-text-secondary);
    max-width: 120px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2394a3b8'%3E%3Cpath d='M4.5 6l3.5 4 3.5-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

/* Ô nhập + nút dán dính liền nhau */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.input-group__btn {
    flex: 0 0 auto;
    width: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lh-bg-muted);
    color: var(--lh-text-secondary);
    border: 1.5px solid var(--lh-border);
    border-left: none;
    border-radius: 0 var(--lh-radius-lg) var(--lh-radius-lg) 0;
    cursor: pointer;
}

.input-group__btn:active {
    background: var(--lh-border);
}

/* ── Nút ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--lh-space-sm);
    min-height: 44px;
    padding: 0 var(--lh-space-lg);
    font-family: var(--lh-font-heading);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    border: 1.5px solid transparent;
    border-radius: var(--lh-radius-lg);
    cursor: pointer;
    /* Không dùng hover-transform: thiết bị cảm ứng chỉ có trạng thái active */
    transition: opacity 0.15s ease;
}

.btn:active {
    opacity: 0.7;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn--block {
    width: 100%;
}

.btn--sm {
    min-height: 36px;
    padding: 0 var(--lh-space-md);
    font-size: 13px;
}

.btn--lg {
    min-height: 44px;
    font-size: 15px;
}

/* CTA chính (Tạo Link Ngay / Mua Ngay): gradient cam → vàng, chữ nâu đậm */
.btn--primary {
    background: var(--lh-gradient-accent);
    color: var(--lh-accent-text);
}

.btn--outline {
    background: var(--lh-bg);
    border-color: var(--lh-primary);
    color: var(--lh-primary);
}

.btn--facebook {
    background: var(--lh-facebook);
    color: #fff;
}

.btn--zalo {
    background: var(--lh-bg);
    border-color: var(--lh-zalo);
    color: var(--lh-zalo);
}

.btn--ghost {
    background: var(--lh-bg-muted);
    color: var(--lh-text-secondary);
}

/* Vòng xoay trong nút submit */
.spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lh-spin 0.8s linear infinite;
}

.spinner.show {
    display: inline-block;
}

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

@keyframes lh-slide-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes lh-pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.55;
    }
}

.processing-text {
    animation: lh-pulse 1.5s ease-in-out infinite;
}

/* ── Alert (JS đổi qua lại alert-success / alert-info / alert-danger) ───── */
.alert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--lh-space-sm);
    padding: var(--lh-space-md);
    border: 1px solid transparent;
    border-radius: var(--lh-radius-lg);
    font-size: 13px;
    font-weight: 600;
}

.alert-success {
    background: var(--lh-success-surface);
    border-color: var(--lh-success-border);
    color: var(--lh-success);
}

.alert-info {
    background: var(--lh-info-surface);
    border-color: var(--lh-info-border);
    color: var(--lh-info);
}

.alert-danger {
    background: var(--lh-error-surface);
    border-color: var(--lh-error-border);
    color: var(--lh-error);
}

/* Toast SweetAlert2 dùng chung font hệ thống */
.swal2-container {
    font-family: var(--lh-font-body);
}
