/* Custom styles for HTMX transitions, form states, progress indicator, and utilities */

/* -------------------- HTMX TRANSITIONS -------------------- */
.htmx-swapping {
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.htmx-settling {
    opacity: 1;
    transition: opacity 0.25s ease-in;
}

.htmx-request {
    /* Indicate loading state on elements that perform requests */
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

/* Simple spinner for request state */
.htmx-request::after {
    content: "";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.8);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* -------------------- FORM STATES -------------------- */
.form-input:focus {
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
    outline: none;
}

.form-error {
    border-color: theme("colors.red.500");
    background-color: rgba(254, 202, 202, 0.05);
}

.form-success {
    border-color: theme("colors.green.500");
    background-color: rgba(209, 250, 229, 0.04);
}

.form-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* -------------------- PROGRESS INDICATOR -------------------- */
.progress-step {
    transition: all 0.2s ease-in-out;
}

.progress-step--active {
    color: var(--tw-color-primary, #7c3aed);
    transform: translateY(-2px);
}

.progress-step--complete {
    color: theme("colors.green.500");
}

/* -------------------- LOADING OVERLAY -------------------- */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

/* -------------------- RESPONSIVE UTILITIES -------------------- */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* small helper for visually hidden text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* -------------------- TUNE-MY-CI HERO & THEME -------------------- */
/* Define a few theme variables used for the new homepage styles */
:root {
    --tmci-emerald-900: #072a23;
    --tmci-emerald-800: #0b6b52;
    --tmci-emerald-700: #0f7a63;
    --tmci-accent: #eaf3f1;
    --tmci-muted-bg: #f7faf9;
}

/* -------------------- GLOBAL TYPOGRAPHY & BASE THEME -------------------- */
/* Apply Poppins site-wide and ensure headings + links match the green theme */
body {
    font-family:
        "Poppins",
        ui-sans-serif,
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--tmci-emerald-900);
    background-color: var(--tmci-muted-bg);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family:
        "Poppins",
        ui-sans-serif,
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
    color: var(--tmci-emerald-900);
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--tmci-emerald-800);
}
a:hover {
    color: var(--tmci-emerald-700);
    text-decoration: underline;
}

/* Make sure the light hero background tone is consistent */
.bg-emerald-50 {
    background-color: var(--tmci-accent) !important;
}

/* Ensure the hero SVG used as decoration fills the section cleanly */
svg[viewBox="0 0 1440 420"] {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Slightly limit modal width for improved readability on large screens */
.modal-box {
    max-width: 48rem;
}

/* Card appearance tweaks to better match the site theme */
.card {
    border-radius: 0.75rem;
    background: linear-gradient(180deg, #ffffff 0%, #fbfffd 100%);
    box-shadow: 0 8px 30px rgba(7, 24, 20, 0.06);
    border: 1px solid rgba(11, 107, 82, 0.06);
    color: var(--tmci-emerald-900);
}

/* A small utility pill used in the hero */
.hero-pill {
    background: #ffffff;
    display: inline-block;
    padding: 1rem 2.5rem;
    border-radius: 9999px;
    box-shadow: 0 8px 30px rgba(16, 24, 24, 0.06);
}

/* CTA button helper; used on the homepage */
.btn-emerald {
    background-color: var(--tmci-emerald-800);
    color: #ffffff;
    border: 0;
}
.btn-emerald:hover {
    background-color: var(--tmci-emerald-700);
}

/* Banner / footer CTA */
.banner-dark {
    background: var(--tmci-emerald-900);
    color: #ffffff;
}

/* Minor responsive heading tweaks for the hero */
@media (min-width: 768px) {
    .hero h1 {
        font-size: 4.5rem;
        line-height: 1;
    }
    .hero h2 {
        font-size: 2.25rem;
    }
}

/* Global primary button override (keeps DaisyUI primary aligned with brand) */
.btn-primary {
    background-color: var(--tmci-emerald-800) !important;
    border-color: transparent !important;
    color: #ffffff !important;
}
.btn-primary:hover {
    background-color: var(--tmci-emerald-700) !important;
}
