/* ==========================================================================
   1. MODAL CONTAINER & ANIMATION (Giữ nguyên logic animation)
   ========================================================================== */
#handdn-watch-modal {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#handdn-watch-modal.active {
    opacity: 1;
    visibility: visible;
}

#handdn-watch-modal .handdn-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 99;
}

#handdn-watch-modal.active .handdn-overlay {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   2. MODAL BOX (Được làm mềm mại và nổi khối hơn)
   ========================================================================== */
.modal-content {
    background: #ffffff;
    margin: 5vh auto;
    padding: 40px;
    border-radius: 12px;
    /* Bo góc mềm mại hơn */
    width: 95%;
    max-width: 600px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    /* Bóng đổ sâu, tơi hơn */
    font-family: 'Montserrat', sans-serif;
    z-index: 999;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#handdn-watch-modal.active .modal-content {
    transform: scale(1) translateY(0);
}

/* Tùy chỉnh thanh cuộn (Scrollbar) bên trong Modal cho tinh tế */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 8px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #161735;
}

/* ==========================================================================
   3. TYPOGRAPHY & HEADER
   ========================================================================== */
.modal-content h2 {
    font-family: 'title-handdn', serif !important;
    letter-spacing: 1.5px;
    color: #161735;
    text-align: center;
    font-size: 26px;
    margin-top: 0;
    margin-bottom: 30px;
}

/* Dòng kẻ trang trí mỏng dưới tiêu đề */
.modal-content h2::after {
    content: '';
    display: block;
    width: 50px;
    height: 2px;
    background: #161735;
    margin: 15px auto 0;
}

/* Nút Close X hiện đại */
.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #161735;
    cursor: pointer;
    background: #f8fafc;
    border-radius: 50%;
    /* Tròn */
    transition: all 0.2s ease;
}

/* ==========================================================================
   4. REPEATER ITEM (Định dạng như một Card cao cấp)
   ========================================================================== */
.repeater-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 25px;
    background: #ffffff;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    /* Cắt header ôm theo góc bo */
}

.item-header {
    background: #f8fafc;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.item-header span:first-child {
    font-family: 'title-handdn', serif !important;
    letter-spacing: 1px;
    color: #161735;
    font-size: 15px;
    font-weight: 600;
}

/* Nút xóa item (màu đỏ tinh tế) */
span.remove-item {
    cursor: pointer;
    font-size: 1rem;
    border-radius: 4px;
    transition: all 0.2s;
}

/* span.remove-item:hover {
    background: #ffe3e3;
    color: #c82333;
} */

.item-body {
    padding: 25px;
}

/* ==========================================================================
   5. FORM & SELECT2 (UI/UX)
   ========================================================================== */
.form-group:not(:last-of-type) {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 400;
    color: #161735;
    letter-spacing: 0.5px;
}

/* Input thường (nếu có bổ sung sau này) */
.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    height: 48px;
    padding: 0 15px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #1e293b;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: #161735;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(22, 23, 53, 0.1);
    outline: none;
}

/* Custom Select2 */
.select2-container--default .select2-selection--single {
    height: 48px !important;
    /* Cao hơn chút cho dễ click trên mobile */
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    /* Bo góc đồng bộ */
    display: flex;
    align-items: center;
    background-color: #f8fafc !important;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
}

/* Hiệu ứng Focus cho Select2 */
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #161735 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(22, 23, 53, 0.1) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 48px !important;
    padding-left: 15px !important;
    color: #1e293b !important;
    font-weight: 500;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px !important;
    right: 10px !important;
}

/* Menu Dropdown của Select2 */
.select2-dropdown {
    z-index: 1000000 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1) !important;
    margin-top: 5px;
    overflow: hidden;
}

.select2-container--default .select2-results__option {
    padding: 12px 15px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #4a5568;
    transition: background-color 0.2s;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #161735 !important;
    color: white !important;
}

/* ==========================================================================
   6. UPGRADE BANNER & BUTTONS
   ========================================================================== */
.handdn-upgrade-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #161735;
    padding: 25px;
    margin: 25px 0;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.handdn-upgrade-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.handdn-text-group {
    flex: 1;
    min-width: 280px;
}

.handdn-icon-box {
    background: #161735;
    color: #fff;
    padding: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(22, 23, 53, 0.3);
}

.handdn-icon-box .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
}

.handdn-upgrade-title {
    margin: 0 0 8px 0 !important;
    font-size: 1.15rem;
    color: #161735;
    font-weight: 700;
}

.handdn-upgrade-desc {
    margin: 0 !important;
    color: #64748b;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Nút Submit / Actions */
.actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* Thiết kế nút bấm chung */
.btn-submit,
#add-btn {
    padding: 15px 25px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Nút Cập Nhật (Primary) */
.btn-submit {
    background: #161735;
    color: #ffffff;
    flex: 1;
    /* Nút chính to hơn */
}

/* Giả định CSS cho Nút Thêm (Add More) nếu có class #add-btn */
#add-btn {
    background: #f1f5f9;
    color: #161735;
    border: 1px solid #e2e8f0;
}

/* Responsive */
@media (max-width: 600px) {
    .handdn-upgrade-content {
        flex-direction: column;
        text-align: center;
    }

    .handdn-icon-box {
        margin-bottom: 10px;
    }

    .actions {
        flex-direction: column-reverse;
    }

    /* Đảo nút trên mobile cho dễ bấm */
    .btn-submit,
    #add-btn {
        width: 100%;
    }

    .modal-content {
        padding: 20px;
    }
}

.watch-preview-container {
    display: none;
    background: #fff;
    text-align: center;
    margin-bottom: 15px;
}

.watch-preview-img {
    max-height: 180px;
    object-fit: contain;
}

.watch-preview-info {
    font-size: 12px;
    margin-top: 5px;
    color: #161735;
}

.watch-preview-info .preview-brand {
    font-weight: 700;
    font-size: 1rem;
}

/*** ==========================================================================
   7. ACCOUNT (Xem trước đồng hồ - Thêm phần thông tin chi tiết)
   ========================================================================== */

.handdn-my-account-watches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
    font-family: 'Montserrat', sans-serif;
}

.handdn-account-watch-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.handdn-account-watch-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(22, 23, 53, 0.1);
    border-color: #161735;
}

.handdn-account-watch-card .card-image {
    height: 180px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.handdn-account-watch-card .card-image img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
}

.handdn-account-watch-card .card-content {
    padding: 20px;
    border-top: 1px solid #f1f5f9;
}

.handdn-account-watch-card .brand-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #161735;
    background: #eff6ff;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.handdn-account-watch-card h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #1e293b;
    line-height: 1.4;
    min-height: 44px;
    /* Đảm bảo các card đều nhau */
}

.handdn-account-watch-card .card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748b;
    padding-top: 15px;
    border-top: 1px dashed #e2e8f0;
}

@media (max-width: 600px) {
    .handdn-my-account-watches-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   TOAST NOTIFICATION (THÔNG BÁO)
   ========================================================================== */

#toast {
    visibility: hidden;
    min-width: 280px;
    background-color: #161735;
    /* Màu mặc định của Handdn */
    color: #ffffff;
    text-align: left;
    border-radius: 8px;
    padding: 16px 20px;
    position: fixed;
    z-index: 999999;
    /* Đảm bảo luôn nằm trên cùng, cao hơn cả Modal */
    top: 40px;
    right: 40px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(50px);
    /* Bắt đầu từ bên phải trượt vào */
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    /* Hiệu ứng nảy (bounce) mượt mà */
}

/* Trạng thái hiển thị */
#toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}

/* Loại thông báo: Thành công */
#toast.success {
    background-color: #ffffff;
    color: #161735;
    border-left: 6px solid #10b981;
    /* Xanh lá */
}

/* Loại thông báo: Lỗi */
#toast.error {
    background-color: #ffffff;
    color: #161735;
    border-left: 6px solid #ef4444;
    /* Đỏ */
}

/* Biểu tượng (Tùy chọn hiển thị icon bằng CSS Pseudo-element) */
#toast.success::before {
    content: '✓';
    display: inline-block;
    color: #10b981;
    font-weight: bold;
    font-size: 16px;
    margin-right: 10px;
}

#toast.error::before {
    content: '✕';
    display: inline-block;
    color: #ef4444;
    font-weight: bold;
    font-size: 16px;
    margin-right: 10px;
}

/* Responsive cho Mobile (Hiển thị ở dưới cùng màn hình) */
@media screen and (max-width: 600px) {
    #toast {
        top: auto;
        bottom: 30px;
        right: 50%;
        width: 90%;
        min-width: unset;
        transform: translate(50%, 50px);
        /* Trượt từ dưới lên */
        text-align: center;
    }

    #toast.show {
        transform: translate(50%, 0);
    }
}