/* Malaka Campaign – frontend styles (2026 redesign) */
.malaka-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
    background: #f9f9f9;
    border-radius: 16px;
    box-sizing: border-box;
    font-family: inherit;
}
.malaka-form-container.is-result {
    background: transparent;
    padding: 0;
    max-width: 480px;
}
.malaka-form-container * { box-sizing: border-box; }

.malaka-step { display: none; }
.malaka-step.active { display: block; }

.malaka-step h3 {
    margin: 0 0 16px;
    font-size: 1.25rem;
}

.malaka-row {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
}

.malaka-row label {
    flex: 0 0 48px;
    font-weight: 700;
    font-size: 24px;
    color: #333;
    text-align: center;
}

.malaka-row input[type="text"],
.malaka-row input[type="email"],
.malaka-row input[type="tel"] {
    flex: 1 1 auto;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.malaka-row input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.18);
}

.malaka-row input.malaka-invalid {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

.malaka-privacy-row {
    margin: 8px 0 18px;
    font-size: 0.95rem;
}
.malaka-privacy-row a { color: #0073aa; }

.malaka-btn {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 12px 22px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 600;
    transition: background .15s ease, transform .1s ease;
}
.malaka-btn:hover  { background: #005177; }
.malaka-btn:active { transform: translateY(1px); }
.malaka-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.malaka-btn-secondary {
    background: #6b7280;
    margin-right: 10px;
}
.malaka-btn-secondary:hover { background: #4b5563; }

/* Legacy response classes kept for backwards compat */
.malaka-response { display: none; }
.malaka-response.is-visible { display: block; }

/* ------------------------------------------------------------------ */
/* Result card (2026)                                                 */
/* ------------------------------------------------------------------ */

.malaka-result {
    --ring: #10b981;
    --ring-bg: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 60%, #a7f3d0 100%);
    --title-grad: linear-gradient(90deg, #059669, #0891b2);
    --title-color: #047857;

    position: relative;
    background: #ffffff;
    border-radius: 24px;
    overflow: hidden;
    text-align: center;
    box-shadow:
        0 24px 60px -24px rgba(15, 23, 42, 0.28),
        0 2px 6px rgba(15, 23, 42, 0.06),
        0 0 0 1px rgba(15, 23, 42, 0.04);
    animation: malaka-result-in .6s cubic-bezier(.16, 1, .3, 1) both;
    max-width: 460px;
    margin: 0 auto;
}

.malaka-result--wrong {
    --ring: #f59e0b;
    --ring-bg: linear-gradient(135deg, #fff7ed 0%, #ffedd5 60%, #fed7aa 100%);
    --title-grad: linear-gradient(90deg, #d97706, #ea580c);
    --title-color: #b45309;
}

.malaka-result__media {
    position: relative;
    padding: 44px 24px 16px;
    background: var(--ring-bg);
    overflow: hidden;
}

.malaka-result__media::after {
    content: "";
    position: absolute;
    inset: auto -20% -60% -20%;
    height: 60%;
    background: radial-gradient(ellipse at center top, rgba(255,255,255,0.65), rgba(255,255,255,0));
    pointer-events: none;
}

.malaka-result__icon {
    width: 96px;
    height: 96px;
    display: block;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.12));
}

.malaka-result__icon-bg {
    fill: #ffffff;
}

.malaka-result__icon-ring {
    fill: none;
    stroke: var(--ring);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 226;
    stroke-dashoffset: 226;
    animation: malaka-draw-ring .75s cubic-bezier(.16, 1, .3, 1) .15s forwards;
}

.malaka-result__icon-path {
    fill: none;
    stroke: var(--ring);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 90;
    stroke-dashoffset: 90;
    animation: malaka-draw-path .45s ease-out .85s forwards;
}

.malaka-result--wrong .malaka-result__icon {
    animation: malaka-headshake .6s ease-out 1.05s 1 both;
    transform-origin: center;
}

.malaka-result__body {
    padding: 24px 28px 32px;
}

.malaka-result__title {
    margin: 0 0 12px;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    background: var(--title-grad);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    /* Safari fallback */
    -webkit-text-fill-color: transparent;
}

@supports not (background-clip: text) {
    .malaka-result__title {
        color: var(--title-color);
        -webkit-text-fill-color: currentColor;
    }
}

.malaka-result__message {
    font-size: 16px;
    line-height: 1.55;
    color: #374151;
    margin: 0;
}
.malaka-result__message p { margin: 0 0 10px; }
.malaka-result__message p:last-child { margin-bottom: 0; }

.malaka-result__actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.malaka-result__btn {
    appearance: none;
    border: none;
    background: #111827;
    color: #fff;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}
.malaka-result__btn:hover  { background: #1f2937; }
.malaka-result__btn:active { transform: translateY(1px); }
.malaka-result__btn--ghost {
    background: transparent;
    color: #374151;
    box-shadow: inset 0 0 0 1px #d1d5db;
}
.malaka-result__btn--ghost:hover { background: #f3f4f6; color: #111827; }

/* ------------------------------------------------------------------ */
/* Confetti (success only)                                            */
/* ------------------------------------------------------------------ */

.malaka-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}
.malaka-confetti span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    transform-origin: center;
    animation: malaka-confetti 1.6s cubic-bezier(.2, .9, .3, 1) 1.05s forwards;
}

.malaka-confetti span:nth-child(1)  { --x: -140px; --y:  -70px; --r:  280deg; background:#10b981; animation-delay: 1.05s; }
.malaka-confetti span:nth-child(2)  { --x:  -90px; --y: -110px; --r: -180deg; background:#0ea5e9; animation-delay: 1.10s; }
.malaka-confetti span:nth-child(3)  { --x:   30px; --y: -130px; --r:  220deg; background:#f59e0b; animation-delay: 1.15s; }
.malaka-confetti span:nth-child(4)  { --x:  100px; --y: -100px; --r: -240deg; background:#ec4899; animation-delay: 1.00s; }
.malaka-confetti span:nth-child(5)  { --x:  150px; --y:  -50px; --r:  160deg; background:#8b5cf6; animation-delay: 1.20s; }
.malaka-confetti span:nth-child(6)  { --x: -160px; --y:    0px; --r: -120deg; background:#10b981; animation-delay: 1.25s; }
.malaka-confetti span:nth-child(7)  { --x: -110px; --y:   60px; --r:  200deg; background:#f59e0b; animation-delay: 1.30s; }
.malaka-confetti span:nth-child(8)  { --x:  -40px; --y:  120px; --r: -260deg; background:#0ea5e9; animation-delay: 1.05s; }
.malaka-confetti span:nth-child(9)  { --x:   60px; --y:  130px; --r:  280deg; background:#ec4899; animation-delay: 1.10s; }
.malaka-confetti span:nth-child(10) { --x:  120px; --y:   80px; --r: -180deg; background:#8b5cf6; animation-delay: 1.18s; }
.malaka-confetti span:nth-child(11) { --x:  170px; --y:   20px; --r:  140deg; background:#10b981; animation-delay: 1.22s; }
.malaka-confetti span:nth-child(12) { --x: -180px; --y:   60px; --r: -220deg; background:#0ea5e9; animation-delay: 1.28s; }
.malaka-confetti span:nth-child(13) { --x:    0px; --y: -150px; --r:  300deg; background:#f59e0b; animation-delay: 1.00s; }
.malaka-confetti span:nth-child(14) { --x:   80px; --y: -140px; --r: -160deg; background:#ec4899; animation-delay: 1.15s; }

@keyframes malaka-confetti {
    0%   { opacity: 0; transform: translate(-50%, -50%) rotate(0deg) scale(.6); }
    10%  { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--x, 0px)), calc(-50% + var(--y, -80px))) rotate(var(--r, 200deg)) scale(1); }
}

/* ------------------------------------------------------------------ */
/* Animations                                                         */
/* ------------------------------------------------------------------ */

@keyframes malaka-result-in {
    0%   { opacity: 0; transform: translateY(28px) scale(.96); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes malaka-draw-ring {
    to { stroke-dashoffset: 0; }
}
@keyframes malaka-draw-path {
    to { stroke-dashoffset: 0; }
}
@keyframes malaka-headshake {
    0%, 100% { transform: translateX(0) rotate(0); }
    20%      { transform: translateX(-7px) rotate(-3deg); }
    40%      { transform: translateX( 6px) rotate( 2deg); }
    60%      { transform: translateX(-4px) rotate(-1deg); }
    80%      { transform: translateX( 2px) rotate( 0.5deg); }
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 480px) {
    .malaka-form-container { padding: 16px; border-radius: 14px; }
    .malaka-row label      { flex-basis: 36px; font-size: 20px; }
    .malaka-btn            { width: 100%; margin: 6px 0; }
    .malaka-btn-secondary  { margin-right: 0; }

    .malaka-result               { border-radius: 20px; }
    .malaka-result__media        { padding: 32px 16px 12px; }
    .malaka-result__icon         { width: 80px; height: 80px; }
    .malaka-result__body         { padding: 20px 20px 26px; }
    .malaka-result__title        { font-size: 22px; }
    .malaka-result__message      { font-size: 15px; }
    .malaka-result__btn          { width: 100%; }
}

/* ------------------------------------------------------------------ */
/* [malaka_stats] grid                                                */
/* ------------------------------------------------------------------ */

.malaka-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    align-items: center;
    background: #000;
    color: #fff;
    padding: 80px 48px;
    font-family: inherit;
}
.malaka-stats-cell { text-align: center; }
.malaka-stats-num {
    display: block;
    font-size: clamp(32px, 5vw, 64px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}
.malaka-stats-label {
    display: block;
    margin-top: 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .malaka-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 36px 16px;
        padding: 48px 20px;
    }
}
@media (max-width: 380px) {
    .malaka-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .malaka-result,
    .malaka-result__icon-ring,
    .malaka-result__icon-path,
    .malaka-result--wrong .malaka-result__icon,
    .malaka-confetti span { animation: none !important; }
    .malaka-result__icon-ring,
    .malaka-result__icon-path { stroke-dashoffset: 0; }
    .malaka-confetti span { display: none; }
}
