/**
 * Custom Styles for Chánh Phạm Theme
 */

/* Remixicon fix */
:where([class^="ri-"])::before {
    content: "\f3c2";
}

.gradient-bg {
    background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-primary) 100%);
}

.floating-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.hero-overlay {
    background: linear-gradient(100deg,
        rgba(var(--hero-overlay-rgb), var(--hero-a1)) 0%,
        rgba(var(--hero-overlay-rgb), var(--hero-a2)) 45%,
        rgba(var(--hero-overlay-rgb), var(--hero-a3)) 100%);
}

.brand-gradient {
    background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-primary) 100%);
}

/* Fix menu display */
header nav ul,
header nav ul.menu,
.mobile-menu ul,
.mobile-menu ul.menu {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
}

header nav ul li,
.mobile-menu ul li {
    list-style: none !important;
    margin: 0 !important;
    display: list-item !important;
}

header nav ul li a,
.mobile-menu ul li a {
    display: block !important;
    text-decoration: none !important;
}

/* Desktop menu spacing */
header nav ul.flex.items-center.space-x-8 li {
    margin-right: 2rem !important;
}

header nav ul.flex.items-center.space-x-8 li:last-child {
    margin-right: 0 !important;
}

/* Mobile menu */
.mobile-menu ul {
    flex-direction: column !important;
    align-items: stretch !important;
}

.mobile-menu ul li {
    margin-bottom: 0.5rem !important;
}

/* Menu Active State */
header nav ul li a.active,
.mobile-menu ul li a.active {
    color: var(--brand-primary) !important;
    font-weight: 600 !important;
}

header nav ul li a:hover,
.mobile-menu ul li a:hover {
    color: var(--brand-primary) !important;
}

/* Slider styles */
.hero-slide {
    transition: opacity 0.6s ease-in-out;
}

.hero-slide:not(.active) {
    opacity: 0 !important;
    display: none !important;
}

.hero-slide.active {
    opacity: 1 !important;
    display: block !important;
}

/* ================ Slider "Câu chuyện thành công" ================
   Trước đây khối này là mockup tĩnh: 5 câu chuyện thì 4 cái bị class
   `hidden`, 5 dấu chấm chỉ là <div> trang trí, và không có JS nào cả.
   Giờ dùng băng chạy (translateX) để kéo/quẹt được — cách duy nhất
   kéo mượt, vì `display:none` thì không thể kéo.
   Markup bên trong từng câu chuyện giữ nguyên, không đổi một class nào.
   ================================================================ */

#success-stories {
    position: relative;
    overflow: hidden;   /* cắt băng chạy; nút nằm trong khung nên không bị cắt */
}

.story-track {
    display: flex;
    width: 100%;
    transition: transform .5s cubic-bezier(.22, .61, .36, 1);
    will-change: transform;
    touch-action: pan-y;   /* vẫn cuộn dọc được, chặn cuộn ngang của trình duyệt */
    cursor: grab;
}

.is-dragging .story-track {
    transition: none;
    cursor: grabbing;
}

/* Mỗi câu chuyện chiếm trọn một khung. Vẫn giữ display:grid của nó. */
.story-track > [data-slider-item] {
    flex: 0 0 100%;
    min-width: 100%;
    -webkit-user-select: none;
    user-select: none;
}

/* Ảnh không bị kéo theo con trỏ khi quẹt */
.story-track img {
    -webkit-user-drag: none;
    pointer-events: none;
}

/* ---- nút trước / sau ---- */
.story-nav {
    position: absolute;
    top: 50%;
    z-index: 10;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    transform: translateY(-50%);
    border: 1px solid rgba(16, 24, 40, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: #344054;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(16, 24, 40, .12);
    transition: background-color .16s, color .16s, border-color .16s;
}

.story-nav:hover {
    background: var(--brand-primary, #d31111);
    border-color: var(--brand-primary, #d31111);
    color: #fff;
}

.story-nav:focus-visible {
    outline: 2px solid var(--brand-primary, #d31111);
    outline-offset: 2px;
}

.story-nav:disabled {
    opacity: .35;
    cursor: default;
}

.story-prev { left: 8px; }
.story-next { right: 8px; }

@media (min-width: 768px) {
    .story-nav { width: 44px; height: 44px; font-size: 26px; }
    .story-prev { left: 12px; }
    .story-next { right: 12px; }
}

/* ---- dấu chấm (giữ đúng kích thước w-3 h-3 của bản cũ) ---- */
.story-indicator {
    padding: 0;
    border: 0;
    background-color: #d1d5db;   /* bg-gray-300 như bản cũ */
    cursor: pointer;
    transition: width .2s, background-color .2s;
}

.story-indicator.is-active {
    width: 1.75rem;
    background-color: var(--brand-primary, #d31111);   /* bg-primary như bản cũ */
}

.story-indicator:focus-visible {
    outline: 2px solid var(--brand-primary, #d31111);
    outline-offset: 2px;
}

/* Table of Contents */
.table-of-contents {
    position: sticky;
    top: 120px;
}

/* Page content headings with IDs */
.prose h2[id],
.prose h3[id] {
    scroll-margin-top: 120px;
}


/* ======================== Contact Form 7 ========================
   CSS để form CF7 nhìn GIỐNG HỆT form viết tay trước đây.
   Số đo lấy đúng từ các class Tailwind của form cũ:
     input : px-4 py-3  -> 12px 16px | border-gray-300 -> #d1d5db
             rounded-lg -> 8px       | text-sm         -> 14px
     label : text-sm font-semibold text-gray-700 mb-2
     gap   : space-y-6 / gap-6 -> 24px
     nút   : py-4 text-lg font-semibold, bo 8px, full width
   ================================================================ */

.mtm-form { display: block; }

/* space-y-6 */
.mtm-form > * + * { margin-top: 24px; }

/* grid md:grid-cols-2 gap-6 */
.mtm-row { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 768px) {
    .mtm-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.mtm-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
}

.mtm-req { color: var(--brand-primary, #d31111); }

/* CF7 bọc mỗi control trong .wpcf7-form-control-wrap -> phải là block đủ rộng */
.mtm-form .wpcf7-form-control-wrap { display: block; width: 100%; }

.mtm-form input[type="text"],
.mtm-form input[type="tel"],
.mtm-form input[type="email"],
.mtm-form input[type="number"],
.mtm-form input[type="url"],
.mtm-form select,
.mtm-form textarea {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background-color: #fff;
    color: #111827;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .15s, box-shadow .15s;
}

.mtm-form select { padding-right: 32px; }
.mtm-form textarea { resize: vertical; min-height: 108px; }

.mtm-form input::placeholder,
.mtm-form textarea::placeholder { color: #9ca3af; }

/* focus:ring-2 focus:ring-primary focus:border-transparent */
.mtm-form input:focus,
.mtm-form select:focus,
.mtm-form textarea:focus {
    outline: none;
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--brand-primary, #d31111);
}

/* text-xs text-gray-500 mt-1 */
.mtm-hint {
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

/* nút gửi: w-full bg-primary text-white py-4 rounded-lg font-semibold text-lg */
.mtm-submit { display: block; }

.mtm-form input[type="submit"],
.mtm-form .wpcf7-submit {
    display: block;
    width: 100%;
    padding: 16px 24px;
    border: 0;
    border-radius: 8px;
    background-color: var(--brand-primary, #d31111);
    color: #fff;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color .16s;
}

.mtm-form input[type="submit"]:hover,
.mtm-form .wpcf7-submit:hover {
    background-color: var(--brand-secondary, #8a0f0f);
}

.mtm-form input[type="submit"]:disabled { opacity: .6; cursor: not-allowed; }

/* ---- thông báo và lỗi của CF7 ---- */
.mtm-form .wpcf7-not-valid-tip {
    display: block;
    margin-top: 6px;
    color: var(--brand-primary, #d31111);
    font-size: 12px;
    font-weight: 500;
}

.mtm-form input.wpcf7-not-valid,
.mtm-form select.wpcf7-not-valid,
.mtm-form textarea.wpcf7-not-valid {
    border-color: var(--brand-primary, #d31111);
}

.wpcf7 form .wpcf7-response-output {
    margin: 24px 0 0;
    padding: 14px 18px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.wpcf7 form.sent .wpcf7-response-output {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.payment-required .wpcf7-response-output {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.wpcf7-spinner { margin: 0 0 0 12px; vertical-align: middle; }

/* nhắc admin khi chưa tạo form */
.mtm-form-notice {
    padding: 14px 18px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
    color: #6b7280;
    font-size: 14px;
}
