/*
==================================================
SPI UI Framework
Component : Card
Version   : 1.2.0
Author    : StudioProjectID
==================================================
*/


/* =====================================================
   BASE CARD
===================================================== */

.spi-card {
    position: relative;

    display: flex;
    flex-direction: column;

    width: 100%;
    min-width: 0;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.98),
            rgba(248, 250, 252, 0.96)
        );

    border:
        1px solid var(--border, #e2e8f0);

    border-radius:
        var(--spi-radius-md, 18px);

    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.02),
        0 8px 25px rgba(15, 23, 42, 0.035);

    overflow: hidden;

    isolation: isolate;

    box-sizing: border-box;

    transition:
        transform 0.28s cubic-bezier(.22, 1, .36, 1),
        box-shadow 0.28s cubic-bezier(.22, 1, .36, 1),
        border-color 0.28s ease,
        background 0.28s ease;
}


/* =====================================================
   SUBTLE SPI LIGHT EFFECT
===================================================== */

.spi-card::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(34, 197, 94, 0.35) 35%,
            rgba(14, 165, 233, 0.25) 65%,
            transparent 100%
        );

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.3s ease;
}


/* =====================================================
   DEFAULT HOVER
===================================================== */

.spi-card:hover {
    transform:
        translateY(-2px);

    border-color:
        rgba(34, 197, 94, 0.18);

    box-shadow:
        0 2px 4px rgba(15, 23, 42, 0.025),
        0 16px 38px rgba(15, 23, 42, 0.065);
}

.spi-card:hover::before {
    opacity: 1;
}


/* =====================================================
   CARD HEADER
===================================================== */

.spi-card-header {
    position: relative;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding:
        22px 24px;

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.75),
            rgba(255, 255, 255, 0.35)
        );

    border-bottom:
        1px solid var(--border, #e2e8f0);

    box-sizing: border-box;
}


/* =====================================================
   CARD BODY
===================================================== */

.spi-card-body {
    position: relative;

    flex: 1 1 auto;

    width: 100%;
    min-width: 0;

    padding: 24px;

    box-sizing: border-box;
}


/* =====================================================
   CARD FOOTER
===================================================== */

.spi-card-footer {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    gap: 12px;

    padding:
        18px 24px;

    background:
        rgba(248, 250, 252, 0.45);

    border-top:
        1px solid var(--border, #e2e8f0);

    box-sizing: border-box;
}


/* =====================================================
   CARD TITLE
===================================================== */

.spi-card-title {
    margin: 0;

    font-size: 16px;

    line-height: 1.4;

    font-weight: 750;

    letter-spacing: -0.01em;

    color:
        var(--text, #0f172a);
}


/* =====================================================
   CARD SUBTITLE
===================================================== */

.spi-card-subtitle {
    margin-top: 5px;

    color:
        var(--text-muted, #94a3b8);

    font-size: 12px;

    line-height: 1.5;
}


/* =====================================================
   BORDERLESS
===================================================== */

.spi-card-borderless {
    border: none;

    box-shadow: none;

    background: transparent;
}

.spi-card-borderless:hover {
    transform: none;

    border-color: transparent;

    box-shadow: none;
}


/* =====================================================
   SHADOW
===================================================== */

.spi-card-shadow {
    box-shadow:
        0 12px 35px rgba(15, 23, 42, 0.08);
}

.spi-card-shadow:hover {
    box-shadow:
        0 18px 45px rgba(15, 23, 42, 0.11);
}


/* =====================================================
   COMPACT
===================================================== */

.spi-card-compact .spi-card-header {
    padding:
        16px 18px;
}

.spi-card-compact .spi-card-body {
    padding: 18px;
}

.spi-card-compact .spi-card-footer {
    padding:
        14px 18px;
}


/* =====================================================
   CLICKABLE
===================================================== */

.spi-card-click {
    cursor: pointer;

    -webkit-tap-highlight-color: transparent;
}

.spi-card-click:hover {
    transform:
        translateY(-5px);

    border-color:
        rgba(34, 197, 94, 0.28);

    box-shadow:
        0 14px 38px rgba(15, 23, 42, 0.09);
}

.spi-card-click:active {
    transform:
        translateY(-1px);
}


/* =====================================================
   GLASS
===================================================== */

.spi-card-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.82),
            rgba(248, 250, 252, 0.65)
        );

    backdrop-filter:
        blur(20px);

    -webkit-backdrop-filter:
        blur(20px);

    border-color:
        rgba(255, 255, 255, 0.7);

    box-shadow:
        0 10px 35px rgba(15, 23, 42, 0.06);
}


/* =====================================================
   GRADIENT
===================================================== */

.spi-card-gradient {
    color: #ffffff;

    border: none;

    background:
        linear-gradient(
            135deg,
            var(--primary, #22c55e),
            var(--secondary, #0ea5e9)
        );

    box-shadow:
        0 12px 35px rgba(34, 197, 94, 0.18);
}

.spi-card-gradient:hover {
    border-color:
        transparent;

    box-shadow:
        0 18px 45px rgba(34, 197, 94, 0.24);
}

.spi-card-gradient .spi-card-title,
.spi-card-gradient .spi-card-subtitle {
    color: #ffffff;
}


/* =====================================================
   CARD CENTER
===================================================== */

.spi-card-center {
    text-align: center;
}


/* =====================================================
   BUSINESS STAT CARD
===================================================== */

.spi-stat-card {
    position: relative;

    height: 100%;
    min-height: 150px;

    overflow: hidden;
}


/*
    Card body menjadi layout utama.
    Ini mencegah double padding karena spi-card
    sudah memiliki spi-card-body.
*/

.spi-stat-card .spi-card-body {
    position: relative;

    z-index: 2;

    height: 100%;

    display: flex;
    flex-direction: column;

    align-items: flex-start;
    justify-content: center;
}


/* =====================================================
   STAT DECORATIVE GLOW
===================================================== */

.spi-stat-card::after {
    content: "";

    position: absolute;

    right: -35px;
    bottom: -45px;

    width: 120px;
    height: 120px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(34, 197, 94, 0.075),
            transparent 70%
        );

    pointer-events: none;

    transition:
        transform 0.4s ease,
        opacity 0.3s ease;
}

.spi-stat-card:hover::after {
    transform:
        scale(1.25);

    opacity: 1;
}


/* =====================================================
   STAT CONTENT
===================================================== */

.spi-stat-content {
    position: relative;

    z-index: 2;

    min-width: 0;

    display: flex;

    flex-direction: column;

    gap: 7px;
}


/* =====================================================
   STAT LABEL
===================================================== */

.spi-stat-label {
    position: relative;

    z-index: 2;

    width: 100%;

    margin-bottom: 10px;

    color:
        var(
            --text-muted,
            var(--spi-text-secondary, #64748b)
        );

    font-size: 14px;

    line-height: 1.4;

    font-weight: 500;

    letter-spacing: 0.01em;
}


/* =====================================================
   STAT VALUE
===================================================== */

.spi-stat-value {
    position: relative;

    z-index: 2;

    width: 100%;

    margin: 0 0 14px 0;

    font-size: 28px;

    line-height: 1.15;

    font-weight: 800;

    letter-spacing: -0.025em;

    color:
        var(
            --text,
            var(--spi-text-primary, #0f172a)
        );
}


/* =====================================================
   STAT VALUE MONEY
===================================================== */

.spi-stat-value.money {
    font-size: 26px;

    letter-spacing: -0.02em;
}


/* =====================================================
   STAT FOOTER
===================================================== */

.spi-stat-footer {
    position: relative;

    z-index: 2;

    width: 100%;

    display: flex;

    align-items: center;
    flex-wrap: wrap;

    gap: 8px;
}


/* =====================================================
   STAT TREND
===================================================== */

.spi-stat-trend {
    display: inline-flex;

    align-items: center;

    gap: 5px;

    margin-top: 2px;

    font-size: 11px;

    font-weight: 600;
}

.spi-stat-trend.up {
    color: #16a34a;
}

.spi-stat-trend.down {
    color: #dc2626;
}

.spi-stat-trend.neutral {
    color: #64748b;
}


/* =====================================================
   STAT ICON
===================================================== */

.spi-stat-icon {
    position: relative;

    z-index: 2;

    width: 58px;
    height: 58px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 17px;

    background:
        linear-gradient(
            145deg,
            #f0fdf4,
            #eff6ff
        );

    border:
        1px solid rgba(34, 197, 94, 0.08);

    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.9),
        0 5px 15px rgba(15, 23, 42, 0.035);

    font-size: 23px;

    transition:
        transform 0.3s cubic-bezier(.22, 1, .36, 1),
        box-shadow 0.3s ease;
}

.spi-stat-card:hover .spi-stat-icon {
    transform:
        translateY(-2px)
        scale(1.04);

    box-shadow:
        0 8px 20px rgba(15, 23, 42, 0.07);
}


/* =====================================================
   BUSINESS MODULE CARD
===================================================== */

.spi-module-card {
    position: relative;

    height: 100%;
    min-height: 280px;

    display: flex;
    flex-direction: column;

    transition:
        transform 0.24s cubic-bezier(.22, 1, .36, 1),
        box-shadow 0.24s ease,
        border-color 0.24s ease;
}


/* =====================================================
   MODULE CARD BODY
===================================================== */

.spi-module-card .spi-card-body {
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;

    box-sizing: border-box;
}


/* =====================================================
   MODULE TITLE
===================================================== */

.spi-module-card-title {
    margin:
        10px 0 10px 0;

    font-size: 20px;

    line-height: 1.35;

    font-weight: 750;

    letter-spacing: -0.015em;

    color:
        var(
            --text,
            var(--spi-text-primary, #0f172a)
        );
}


/* =====================================================
   MODULE DESCRIPTION
===================================================== */

.spi-module-card-description {
    flex: 1 1 auto;

    margin:
        0;

    font-size: 15px;

    line-height: 1.7;

    color:
        var(
            --text-muted,
            var(--spi-text-secondary, #64748b)
        );
}


/* =====================================================
   MODULE ACTION
===================================================== */

.spi-module-card-action {
    width: 100%;

    margin-top: 22px;

    display: flex;

    align-items: center;

    gap: 10px;
}


/* =====================================================
   MODULE CARD HOVER
===================================================== */

.spi-module-card:hover {
    transform:
        translateY(-3px);
}


/* =====================================================
   CARD LINK / ACTION
===================================================== */

.spi-card-action {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    color:
        var(--primary, #22c55e);

    font-size: 12px;

    font-weight: 700;

    text-decoration: none;

    transition:
        color 0.2s ease,
        gap 0.2s ease;
}

.spi-card-action:hover {
    color: #15803d;

    gap: 9px;
}


/* =====================================================
   CARD DIVIDER
===================================================== */

.spi-card-divider {
    width: 100%;

    height: 1px;

    background:
        var(--border, #e2e8f0);
}


/* =====================================================
   BUSINESS CTA
===================================================== */

.spi-business-cta {
    overflow: hidden;
}

.spi-business-cta .spi-card-body {
    padding-top: 28px;
    padding-bottom: 28px;
}

.spi-business-cta-content {
    flex: 1 1 auto;

    min-width: 260px;
}

.spi-business-cta-content h2 {
    margin-top: 0;

    font-size: 24px;

    font-weight: 750;

    line-height: 1.3;

    letter-spacing: -0.02em;
}

.spi-business-cta-content p {
    max-width: 700px;

    line-height: 1.6;
}


/*
    Pastikan teks pada gradient CTA tetap terbaca.
*/

.spi-card-gradient.spi-business-cta,
.spi-card-gradient.spi-business-cta h1,
.spi-card-gradient.spi-business-cta h2,
.spi-card-gradient.spi-business-cta h3,
.spi-card-gradient.spi-business-cta p {
    color: #ffffff;
}


/* =====================================================
   LOADING
===================================================== */

.spi-card-loading {
    position: relative;

    overflow: hidden;
}

.spi-card-loading::after {
    content: "";

    position: absolute;

    inset: 0;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.55),
            transparent
        );

    transform:
        translateX(-100%);

    animation:
        spi-card-shimmer 1.5s infinite;

    pointer-events: none;
}

@keyframes spi-card-shimmer {

    100% {
        transform:
            translateX(100%);
    }

}


/* =====================================================
   DISABLED
===================================================== */

.spi-card-disabled {
    opacity: 0.55;

    pointer-events: none;

    filter:
        grayscale(0.15);
}


/* =====================================================
   TABLET
===================================================== */

@media (max-width: 992px) {

    .spi-stat-card {
        min-height: 140px;
    }

    .spi-module-card {
        min-height: 260px;
    }

}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 768px) {

    .spi-card-header {
        flex-direction: column;

        align-items: flex-start;

        gap: 10px;
    }

    .spi-card-footer {
        flex-direction: column;

        align-items: stretch;
    }


    /* -----------------------------------------
       STAT
    ----------------------------------------- */

    .spi-stat-card {
        min-height: auto;
    }

    .spi-stat-card .spi-card-body {
        justify-content: flex-start;
    }

    .spi-stat-icon {
        width: 52px;
        height: 52px;

        border-radius: 15px;

        font-size: 21px;
    }

    .spi-stat-value {
        font-size: 25px;
    }

    .spi-stat-value.money {
        font-size: 24px;
    }


    /* -----------------------------------------
       MODULE
    ----------------------------------------- */

    .spi-module-card {
        min-height: auto;
    }

    .spi-module-card-description {
        flex: none;
    }


    /* -----------------------------------------
       CTA
    ----------------------------------------- */

    .spi-business-cta .spi-card-body {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .spi-business-cta-content {
        min-width: 0;
        width: 100%;
    }

    .spi-business-cta-content h2 {
        font-size: 21px;
    }

}


/* =====================================================
   SMALL MOBILE
===================================================== */

@media (max-width: 480px) {

    .spi-card-header {
        padding: 18px;
    }

    .spi-card-body {
        padding: 18px;
    }

    .spi-card-footer {
        padding:
            15px 18px;
    }


    /* -----------------------------------------
       STAT
    ----------------------------------------- */

    .spi-stat-label {
        font-size: 12px;
    }

    .spi-stat-value {
        font-size: 23px;
    }

    .spi-stat-value.money {
        font-size: 22px;
    }


    /* -----------------------------------------
       MODULE
    ----------------------------------------- */

    .spi-module-card-title {
        font-size: 18px;
    }

    .spi-module-card-description {
        font-size: 14px;

        line-height: 1.65;
    }

    .spi-module-card-action {
        margin-top: 18px;
    }


    /* -----------------------------------------
       CTA
    ----------------------------------------- */

    .spi-business-cta-content h2 {
        font-size: 20px;
    }

}


/* =====================================================
   REDUCED MOTION
===================================================== */

@media (prefers-reduced-motion: reduce) {

    .spi-card,
    .spi-card-click,
    .spi-module-card,
    .spi-stat-icon,
    .spi-stat-card::after {
        transition: none !important;
    }

    .spi-card:hover,
    .spi-card-click:hover,
    .spi-module-card:hover {
        transform: none;
    }

    .spi-card-loading::after {
        animation: none;
    }

}