/**
 * Thinh Auth Flow - Modern & Premium UI Stylesheet
 * Includes high-end popup modal, smooth micro-animations & glassmorphism
 */

/* ===================================================
   1. MAIN WRAPPER & CONTAINER
   =================================================== */
.taf-wrapper {
    width: 100%;
    padding: 35px 15px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.taf-card {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 16px;
    padding: 40px 36px;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.06), 0 20px 25px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.9);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.taf-card:hover {
    box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.08), 0 10px 15px -5px rgba(0, 0, 0, 0.04);
}

/* Shake animation for errors */
.taf-shake {
    animation: taf-shake-anim 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes taf-shake-anim {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(3px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
    40%, 60% { transform: translate3d(5px, 0, 0); }
}

/* ===================================================
   2. HEADER & TYPOGRAPHY
   =================================================== */
.taf-header {
    margin-bottom: 28px;
}

.taf-title {
    font-size: 25px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: 0 0 10px 0 !important;
    letter-spacing: -0.4px;
    line-height: 1.3 !important;
}

.taf-subtitle {
    font-size: 14.5px !important;
    color: #0d9488 !important; /* Soft teal / cyan tone from design */
    margin: 0 !important;
    line-height: 1.5 !important;
    font-weight: 500;
}

/* ===================================================
   3. FORMS & INPUTS
   =================================================== */
.taf-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0;
}

.taf-form-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin: 0;
    position: relative;
}

.taf-input {
    width: 100% !important;
    height: 48px !important;
    padding: 12px 18px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 10px !important;
    font-size: 15px !important;
    color: #1e293b !important;
    background-color: #f8fafc !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.taf-input::placeholder {
    color: #94a3b8;
    font-size: 14px;
}

.taf-input:hover {
    border-color: #94a3b8 !important;
    background-color: #ffffff !important;
}

.taf-input:focus {
    border-color: #475569 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(71, 85, 105, 0.12) !important;
}

.taf-input-center {
    text-align: center !important;
    font-size: 22px !important;
    letter-spacing: 6px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

/* ===================================================
   4. EXTRA ELEMENTS & LINKS
   =================================================== */
.taf-resend-box {
    font-size: 14px;
    color: #64748b;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: -6px;
}

.taf-resend-box .taf-link {
    color: #2563eb;
    font-weight: 600;
}

.taf-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13.5px;
    color: #64748b;
    margin-top: -4px;
}

.taf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 13.5px;
    color: #475569;
}

.taf-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    border-radius: 4px;
    accent-color: #475569;
}

/* ===================================================
   5. BUTTONS (PILL SHAPE WITH HIGH-END FEEL)
   =================================================== */
.taf-btn-group {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

.taf-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    border: none !important;
    cursor: pointer !important;
    font-family: inherit !important;
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    user-select: none;
}

.taf-btn-primary {
    background: linear-gradient(180deg, #626874 0%, #525762 100%) !important;
    color: #ffffff !important;
    border-radius: 9999px !important;
    padding: 13px 36px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    box-shadow: 0 4px 14px rgba(71, 77, 87, 0.28) !important;
    min-width: 170px;
}

.taf-btn-primary:hover {
    background: linear-gradient(180deg, #505661 0%, #3f444e 100%) !important;
    box-shadow: 0 6px 18px rgba(50, 55, 63, 0.35) !important;
    transform: translateY(-2px);
}

.taf-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(50, 55, 63, 0.2) !important;
}

.taf-btn .taf-icon {
    display: inline-block;
    vertical-align: middle;
    transition: transform 0.25s ease;
}

.taf-btn:hover .taf-icon {
    transform: translateX(4px);
}

.taf-btn.is-loading {
    opacity: 0.85;
    pointer-events: none;
}

.taf-btn.is-loading .taf-icon {
    animation: taf-spin 0.8s linear infinite;
}

@keyframes taf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Inline Messages (Used for error/warning) */
.taf-message {
    min-height: 22px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    animation: taf-fade-in 0.3s ease;
}

.taf-message.taf-msg-error {
    display: block;
    color: #e11d48;
    background: #ffe4e6;
    border: 1px solid #fecdd3;
    padding: 8px 14px;
    border-radius: 8px;
}

.taf-message.taf-msg-info {
    display: block;
    color: #0284c7;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    padding: 8px 14px;
    border-radius: 8px;
}

@keyframes taf-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Secondary footer links */
.taf-link {
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 13.5px;
}

.taf-link:hover {
    color: #0f172a;
    text-decoration: underline;
}

.taf-link-back {
    color: #64748b;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.taf-link-back:hover {
    color: #0f172a;
}

.taf-footer-links {
    margin-top: 14px;
    font-size: 14px;
    color: #64748b;
}

.taf-footer-links .taf-link {
    font-weight: 600;
    color: #2563eb;
}

/* ===================================================
   6. PREMIUM SUCCESS POPUP MODAL (MODERN & SLEEK)
   =================================================== */
.taf-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 9999999 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.taf-modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.taf-modal-card {
    background: #ffffff !important;
    width: 100% !important;
    max-width: 420px !important;
    border-radius: 24px !important;
    padding: 36px 30px 30px 30px !important;
    text-align: center !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
    box-sizing: border-box !important;
    transform: scale(0.88) translateY(20px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    position: relative;
    overflow: hidden;
}

.taf-modal-overlay.is-active .taf-modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Success Icon Circle with Glowing Pulse */
.taf-modal-icon-wrapper {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.taf-modal-icon-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 25px -5px rgba(34, 197, 94, 0.45);
    animation: taf-pulse 2s infinite;
}

@keyframes taf-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
    70% { box-shadow: 0 0 0 16px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Animated Checkmark inside Icon */
.taf-modal-checkmark {
    width: 38px;
    height: 38px;
    stroke: #ffffff;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.taf-checkmark-path {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: taf-draw-check 0.5s 0.2s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes taf-draw-check {
    100% { stroke-dashoffset: 0; }
}

/* Modal Typography */
.taf-modal-title {
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: 0 0 8px 0 !important;
    line-height: 1.3 !important;
}

.taf-modal-desc {
    font-size: 14.5px !important;
    color: #64748b !important;
    margin: 0 0 24px 0 !important;
    line-height: 1.5 !important;
}

/* Countdown Progress Bar */
.taf-modal-progress {
    width: 100%;
    height: 4px;
    background: #f1f5f9;
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 22px;
}

.taf-modal-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10b981 0%, #06b6d4 100%);
    border-radius: 9999px;
    transition: width linear;
}

/* Modal Action Button */
.taf-modal-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    background: #0f172a !important;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 12px !important;
    padding: 11px 26px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    transition: all 0.25s ease !important;
}

.taf-modal-btn:hover {
    background: #1e293b !important;
    transform: translateY(-1px);
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .taf-card {
        padding: 30px 20px;
        border-radius: 14px;
    }
    .taf-title {
        font-size: 22px !important;
    }
    .taf-btn-primary {
        width: 100%;
    }
    .taf-modal-card {
        padding: 28px 20px 24px 20px !important;
    }
}
