/**
 * Stylesheet: Trang Đăng Ký Tết Trung Thu 2026 Tòa S5
 * Tối ưu hóa toàn diện cho Desktop & Mobile (iOS / Android / Tablet)
 */

:root {
    --ma-primary: #b91c1c;
    --ma-primary-light: #ef4444;
    --ma-primary-dark: #7f1d1d;
    --ma-gold: #f59e0b;
    --ma-gold-light: #fef3c7;
    --ma-gold-dark: #b45309;
    --ma-navy: #0f172a;
    --ma-blue: #2563eb;
    --ma-bg: #fffbeb;
    --ma-card: #ffffff;
    --ma-text: #1e293b;
    --ma-text-muted: #64748b;
    --ma-border: #fde68a;
    --ma-radius: 16px;
    --ma-shadow: 0 10px 25px -5px rgba(185, 28, 28, 0.08), 0 8px 10px -6px rgba(185, 28, 28, 0.04);
}

*, *::before, *::after {
    box-sizing: border-box;
}

.ma-reg-page {
    background-color: var(--ma-bg);
    background-image: 
        radial-gradient(at 10% 20%, rgba(254, 243, 199, 0.8) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(254, 226, 226, 0.6) 0px, transparent 50%);
    min-height: 100vh;
    padding-bottom: 60px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ma-text);
    overflow-x: hidden;
}

/* ==========================================================================
   HERO BANNER
   ========================================================================== */
.ma-hero {
    position: relative;
    background: linear-gradient(135deg, #1e1b4b 0%, #31103f 50%, #881337 100%);
    color: #ffffff;
    padding: 55px 20px 75px;
    text-align: center;
    overflow: hidden;
}

.ma-hero-decor-moon {
    position: absolute;
    top: -40px;
    right: 5%;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, #fef08a 0%, #facc15 60%, rgba(250, 204, 21, 0) 70%);
    border-radius: 50%;
    filter: blur(8px);
    opacity: 0.75;
    pointer-events: none;
}

.ma-hero-decor-lantern {
    position: absolute;
    font-size: 28px;
    animation: floatLantern 4s ease-in-out infinite alternate;
    pointer-events: none;
    opacity: 0.85;
}

.ma-lantern-1 { top: 20px; left: 6%; animation-delay: 0s; }
.ma-lantern-2 { top: 30px; right: 8%; animation-delay: 1.5s; }
.ma-lantern-3 { bottom: 25px; left: 14%; animation-delay: 0.8s; font-size: 22px; }

@keyframes floatLantern {
    0% { transform: translateY(0) rotate(-3deg); }
    100% { transform: translateY(-12px) rotate(3deg); }
}

.ma-hero-container {
    max-width: 780px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.ma-badge-org {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #fef08a;
    border: 1px solid rgba(254, 240, 138, 0.3);
    margin-bottom: 16px;
    max-width: 100%;
    word-break: break-word;
}

.ma-hero-title {
    font-size: 32px;
    font-weight: 900;
    line-height: 1.3;
    margin: 0 0 14px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    color: #ffffff;
}

.ma-hero-subtitle {
    font-size: 15px;
    line-height: 1.6;
    color: #fecdd3;
    margin: 0 auto 22px;
    max-width: 640px;
}

/* Countdown Box */
.ma-countdown-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    flex-wrap: wrap;
}

.ma-countdown-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #fef08a;
}

.ma-count-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 7px;
    border-radius: 6px;
    min-width: 30px;
    text-align: center;
    display: inline-block;
}

/* ==========================================================================
   MAIN WRAPPER & HIGHLIGHTS GRID
   ========================================================================== */
.ma-main-container {
    max-width: 860px;
    margin: -40px auto 0;
    padding: 0 16px;
    position: relative;
    z-index: 10;
}

.ma-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.ma-info-card {
    background: #ffffff;
    border-radius: var(--ma-radius);
    padding: 16px 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    border: 1px solid #fed7aa;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.ma-info-card-icon {
    font-size: 24px;
    line-height: 1;
    background: #fff7ed;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

.ma-info-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ma-gold-dark);
    margin-bottom: 3px;
    letter-spacing: 0.3px;
}

.ma-info-card-val {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ma-navy);
    line-height: 1.4;
}

/* ==========================================================================
   FORM CONTAINER & ELEMENTS
   ========================================================================== */
.ma-form-wrapper {
    background: #ffffff;
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: var(--ma-shadow);
    border: 1px solid #fde68a;
    position: relative;
}

.ma-section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 800;
    color: var(--ma-primary-dark);
    border-bottom: 2px solid #fef3c7;
    padding-bottom: 8px;
    margin: 26px 0 16px;
    line-height: 1.4;
}

.ma-section-heading:first-of-type {
    margin-top: 0;
}

.ma-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.ma-form-group {
    margin-bottom: 16px;
}

.ma-form-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}

.ma-form-label .required {
    color: #dc2626;
    margin-left: 2px;
}

.ma-form-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}

.ma-input,
.ma-textarea,
.ma-select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    font-size: 15px;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.ma-input:focus,
.ma-textarea:focus,
.ma-select:focus {
    outline: none;
    border-color: var(--ma-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

/* Building Pill Selector */
.ma-pill-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.ma-pill-label {
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ma-pill-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ma-pill-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    min-height: 48px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14.5px;
    font-weight: 700;
    color: #475569;
    text-align: center;
    transition: all 0.2s ease;
}

.ma-pill-label input[type="radio"]:checked + .ma-pill-box {
    background: #fef2f2;
    border-color: var(--ma-primary);
    color: var(--ma-primary);
    box-shadow: 0 3px 8px rgba(185, 28, 28, 0.12);
}

/* Children count pills */
.ma-children-pills {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.ma-children-pills .ma-pill-box {
    padding: 10px 4px;
    font-size: 14px;
    min-height: 44px;
}

/* Dynamic Child Inputs */
.ma-child-inputs-container {
    background: #fffbeb;
    border: 1.5px dashed #fcd34d;
    border-radius: 12px;
    padding: 16px;
    margin-top: 8px;
}

.ma-child-item {
    margin-bottom: 12px;
}

.ma-child-item:last-child {
    margin-bottom: 0;
}

/* Radio Card Option */
.ma-radio-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.ma-radio-card:hover {
    background: #f1f5f9;
}

.ma-radio-card input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--ma-primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    cursor: pointer;
}

.ma-radio-card-content {
    font-size: 14px;
    color: #334155;
    line-height: 1.45;
    flex: 1;
}

.ma-radio-card.active {
    background: #fff7ed;
    border-color: #f97316;
}

.ma-zalo-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #0068ff;
    color: #ffffff !important;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    margin-top: 6px;
    box-shadow: 0 2px 4px rgba(0, 104, 255, 0.2);
}

/* Notice Box */
.ma-notice-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 13px;
    color: #1e40af;
    line-height: 1.6;
    margin-bottom: 20px;
}

.ma-notice-box ul {
    margin: 6px 0 0 18px;
    padding: 0;
}

.ma-notice-box li {
    margin-bottom: 4px;
}

/* Submit Button */
.ma-btn-submit {
    width: 100%;
    min-height: 52px;
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 50%, #ea580c 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.28);
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.ma-btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(220, 38, 38, 0.38);
}

.ma-btn-submit:active:not(:disabled) {
    transform: scale(0.98);
}

.ma-btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Loading Spin */
.ma-spin {
    animation: maSpin 1s linear infinite;
    display: inline-block;
}

@keyframes maSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   SUCCESS CELEBRATION MODAL
   ========================================================================== */
.ma-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.ma-modal-content {
    background: #ffffff;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px 22px;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    animation: maPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes maPopIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.ma-modal-icon {
    width: 72px;
    height: 72px;
    background: #f0fdf4;
    border: 3px solid #86efac;
    color: #16a34a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 14px;
}

.ma-modal-title {
    font-size: 22px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 6px;
}

.ma-modal-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 16px;
}

.ma-modal-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    text-align: left;
    font-size: 13.5px;
    color: #334155;
    margin-bottom: 18px;
}

.ma-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed #e2e8f0;
}

.ma-summary-row:last-child {
    border-bottom: none;
}

.ma-summary-row span {
    flex-shrink: 0;
}

.ma-summary-row strong {
    text-align: right;
    word-break: break-word;
}

.ma-modal-btn-close {
    background: #1e293b;
    color: #ffffff;
    border: none;
    padding: 13px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    min-height: 48px;
    transition: background 0.2s ease;
}

.ma-modal-btn-close:hover {
    background: #0f172a;
}

#ma-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100000;
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE ADJUSTMENTS
   ========================================================================== */

/* Tablet (max-width: 768px) */
@media (max-width: 768px) {
    .ma-input,
    .ma-textarea,
    .ma-select {
        font-size: 16px; /* Prevents auto-zoom on iOS Safari */
    }
    
    .ma-form-row {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* Mobile Devices (max-width: 640px) */
@media (max-width: 640px) {
    .ma-hero {
        padding: 38px 14px 60px;
    }

    .ma-hero-decor-lantern {
        font-size: 22px;
    }

    .ma-lantern-1 { left: 4%; top: 12px; }
    .ma-lantern-2 { right: 4%; top: 18px; }

    .ma-badge-org {
        font-size: 11px;
        padding: 5px 12px;
        margin-bottom: 12px;
    }

    .ma-hero-title {
        font-size: clamp(20px, 5.8vw, 26px);
        margin-bottom: 10px;
    }

    .ma-hero-subtitle {
        font-size: 13.5px;
        margin-bottom: 18px;
    }

    .ma-countdown-box {
        padding: 8px 12px;
        font-size: 12.5px;
        gap: 8px;
    }

    .ma-count-item {
        min-width: 26px;
        padding: 2px 5px;
        font-size: 13px;
    }

    .ma-main-container {
        margin: -30px auto 0;
        padding: 0 12px;
    }

    .ma-info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 18px;
    }

    .ma-info-card {
        padding: 12px 14px;
        border-radius: 12px;
    }

    .ma-info-card-icon {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }

    .ma-info-card-val {
        font-size: 13px;
    }

    .ma-form-wrapper {
        padding: 20px 14px;
        border-radius: 16px;
    }

    .ma-section-heading {
        font-size: 15px;
        margin: 20px 0 12px;
    }

    .ma-pill-box {
        padding: 10px 4px;
        font-size: 13.5px;
    }

    .ma-children-pills {
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
    }

    .ma-children-pills .ma-pill-box {
        padding: 8px 2px;
        font-size: 12.5px;
    }

    .ma-child-inputs-container {
        padding: 12px;
    }

    .ma-btn-submit {
        font-size: 15px;
        padding: 14px 16px;
    }

    .ma-modal-content {
        padding: 24px 16px;
    }

    .ma-modal-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }

    .ma-modal-title {
        font-size: 20px;
    }
}

/* Extra Small Phones (iPhone SE, 320px - 375px) */
@media (max-width: 375px) {
    .ma-children-pills {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .ma-hero-title {
        font-size: 19px;
    }
    
    .ma-btn-submit {
        font-size: 14px;
        padding: 12px;
    }
}
