/* reset css */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    line-height: 1;
}

ol,
ul {
    list-style: none;
}

blockquote,
q {
    quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* end reset css */

/* File css dùng chung cho mọi dự án */
.required-star {
    color: var(--red) !important;
}

.password-hint {
    margin-top: 4px;
}

.role-hint,
.password-hint {
    font-size: 11px;
    color: #718096;
    font-style: italic;
    margin-bottom: 0;
}

.h1 {
    font-size: 28px;
    line-height: 44px;
    font-weight: 400;
    letter-spacing: -0.2px;
}

.colorXam {
    color: #999;
}

.colorBlack {
    color: #2c2c2c;
}

h1 {
    font-size: 28px;
}

body {
    font-size: 14px;
}

/* ========== alert ========== */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius);
    font-size: var(--fs-sm);
    margin-bottom: 16px;
    line-height: 1.35;
}

.alert-error {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-success i {
    color: var(--success);
}

/* ========== end alert ========== */

/* ========== Toast notifications ========== */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);   /* top-center — dùng chung mọi trang */
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 450px;
    font-size: 14px;
    pointer-events: auto;
    transform: translateY(-20px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Success toast */
.toast.success {
    color: #0f5132;
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
}

.toast.success span:first-child {
    font-weight: bold;
    font-size: 16px;
}

/* Error toast */
.toast.error {
    background-color: var(--red-dark);
    color: #fff;
    border-color: var(--red-dark);
}

.toast.error span:first-child {
    font-weight: 700;
    font-size: 15px;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: rgba(255,255,255,.75); /* default: dùng cho error (nền đỏ) */
    margin-left: auto;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.toast-close:hover {
    color: #fff;
}

/* Nút X của success toast phải xanh đậm (nền mint) */
.toast.success .toast-close {
    color: #0f5132;
    opacity: 0.65;
}
.toast.success .toast-close:hover {
    color: #0a3d20;
    opacity: 1;
}

.fe-page .toast-container,
#toast-container {
    top: 72px !important;
    right: 20px !important;
}

#toast-container > .toast {
    font-size: 14px !important;
    opacity: 1 !important;
    border-radius: 8px !important;
    padding: 12px 15px 12px 50px !important;
    background-size: 20px !important;
    background-position: 15px center !important;
}

#toast-container > .toast .toast-message {
    font-size: 14px !important;
}

/* ── Override toastr success ── */
#toast-container > .toast-success {
    background-color: #d1e7dd !important;
    color: #0f5132 !important;
    border: 1px solid #badbcc !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230f5132'><path d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/></svg>") !important;
}

#toast-container > .toast-success .toast-close-button {
    color: #0f5132 !important;
    -webkit-text-shadow: none !important;
    text-shadow: none !important;
    background: transparent !important;
    opacity: 0.65 !important;
}

#toast-container > .toast-success .toast-close-button:hover {
    color: #0a3d20 !important;
    opacity: 1 !important;
}

/* ── Override toastr error ── */
#toast-container > .toast-error {
    background-color: var(--red, #b20707) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 20px rgba(178, 7, 7, .25) !important;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'><path d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") !important;
}

#toast-container > .toast-error:hover {
    background-color: var(--red-dark, #c62828) !important;
}

#toast-container > .toast-error .toast-close-button {
    color: #fff !important;
    -webkit-text-shadow: none !important;
    text-shadow: none !important;
    background: transparent !important;
    opacity: 0.75 !important;
}

#toast-container > .toast-error .toast-close-button:hover {
    color: #fff !important;
    opacity: 1 !important;
}

/* ══════════════════════════════════════════════════════════════
   FORM COMPONENTS — Dùng chung toàn dự án
   .form-label  : label chuẩn cho mọi form
   .form-input  : input chuẩn kiểu login (có padding cho icon 2 bên)
══════════════════════════════════════════════════════════════ */

/* Label chung */
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
}
.form-label .required,
.form-label .star {
    color: var(--red, #e53935);
}

/* Input chung — kiểu login (có chỗ cho icon trái + eye phải) */
.form-input {
    width: 100%;
    padding: 12px 44px;
    font-family: inherit;
    font-size: 14px;
    color: #1a1a1a;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    line-height: 1.4;
}
.form-input:focus {
    border-color: var(--red, #e53935);
    box-shadow: 0 0 0 3px rgba(229, 57, 53, .08);
}
.form-input::placeholder {
    color: #bdbdbd;
}
.form-input:disabled,
.form-input[readonly] {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Variant: không có icon bên trái */
.form-input.no-icon {
    padding-left: 14px;
}

/* Variant: không có eye button bên phải */
.form-input.no-eye {
    padding-right: 14px;
}

/* ════════════════════════════════════════════════════════════════════
   SWIPER GALLERY — style dùng chung cho component <x-swiper-gallery>
   (ảnh chính + thumbnail + nút prev/next + đếm ảnh + zoom).
   --swg-h: chiều cao khung ảnh chính (truyền qua inline style ở component).
   ════════════════════════════════════════════════════════════════════ */
.sw-gallery { width: 100%; }
.sw-gallery .sw-main {
    width: 100%; aspect-ratio: var(--media-ratio);
    border-radius: 12px; overflow: hidden; background: #111;
}
.sw-gallery .sw-main .swiper-wrapper { height: 100%; }
.sw-gallery .sw-main .swiper-slide { height: 100%; display: flex; align-items: center; justify-content: center; background: #111; }
.sw-gallery .sw-main .swiper-zoom-container { width: 100%; height: 100%; }
.sw-gallery .sw-main .swiper-slide img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }

/* Nút Zoom góc dưới-trái ảnh chính */
.sw-gallery .sw-zoom-btn {
    position: absolute; left: 12px; bottom: 12px; z-index: 11;
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(0,0,0,.5); color: #fff; border: none;
    padding: 5px 11px; border-radius: 20px; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: background .15s;
}
.sw-gallery .sw-zoom-btn:hover { background: rgba(0,0,0,.75); }

/* Nút prev / next */
.sw-gallery .swiper-button-prev,
.sw-gallery .swiper-button-next {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(0,0,0,.45); color: #fff;
}
.sw-gallery .swiper-button-prev:hover,
.sw-gallery .swiper-button-next:hover { background: rgba(0,0,0,.7); }
.sw-gallery .swiper-button-prev::after,
.sw-gallery .swiper-button-next::after { font-size: 15px; font-weight: 700; }

/* Đếm ảnh (fraction) */
.sw-gallery .swiper-pagination {
    left: auto; right: 12px; bottom: 12px; width: auto;
    background: rgba(0,0,0,.5); color: #fff;
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* Thumbnail phía dưới */
.sw-gallery .sw-thumbs { margin-top: 10px; }
.sw-gallery .sw-thumbs .swiper-slide {
    width: 88px; height: 62px; border-radius: 8px; overflow: hidden;
    cursor: pointer; opacity: .55; border: 2px solid transparent;
    transition: opacity .15s, border-color .15s;
}
.sw-gallery .sw-thumbs .swiper-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sw-gallery .sw-thumbs .swiper-slide-thumb-active { opacity: 1; border-color: var(--red, #c0392b); }

@media (max-width: 768px) {
    .sw-gallery .sw-thumbs .swiper-slide { width: 64px; height: 46px; }
}

/* ── Swiper carousel (nhiều item/hàng, tự chạy) — dùng cho tiện ích... ── */
.sw-carousel { position: relative; width: 100%; padding: 0 4px; }
.sw-carousel .swc-main { overflow: hidden; }
.sw-carousel .swiper-slide { height: auto; }
.swc-card {
    background: #FDFBF2; border: 1px solid var(--bdr, #eaecf0); border-radius: 10px;
    overflow: hidden; height: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: transform .22s, box-shadow .22s;
}
.swc-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.swc-img { width: 100%; aspect-ratio: var(--media-ratio); overflow: hidden; background: #eee; }
.swc-img img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; transition: transform .4s; }
.swc-card:hover .swc-img img { transform: scale(1.05); }
.swc-body { padding: 10px 12px; }
.swc-cap {
    font-size: var(--fs-sm); font-weight: 700; color: #1a1a1a; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.swc-desc {
    margin-top: 4px; font-size: 12px; color: #777; text-align: center; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* Nút prev/next (đặt ngoài mép 2 bên) */
.sw-carousel .swiper-button-prev,
.sw-carousel .swiper-button-next {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(0,0,0,.45); color: #fff; margin-top: 0;
    /* Căn giữa theo phần ẢNH (bias lên ~nửa chiều cao caption) do dùng aspect-ratio */
    top: calc(50% - 22px); transform: translateY(-50%);
}
.sw-carousel .swiper-button-prev:hover,
.sw-carousel .swiper-button-next:hover { background: var(--red, #c0392b); }
.sw-carousel .swiper-button-prev::after,
.sw-carousel .swiper-button-next::after { font-size: 15px; font-weight: 700; }
.sw-carousel .swiper-button-prev { left: -4px; }
.sw-carousel .swiper-button-next { right: -4px; }

.media-frame {
    aspect-ratio: var(--media-ratio);
    overflow: hidden;
}
.media-frame > img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
