/* ==========================================================
   SPI PLATFORM
   Dashboard Layout
   Version : 1.1.0
   Design  : Premium Enterprise / SaaS
========================================================== */


/* ==========================================================
   APPLICATION
========================================================== */

.spi-app {
    min-height: 100vh;

    display: flex;

    background:
        radial-gradient(
            circle at 90% 0%,
            rgba(34, 197, 94, 0.035),
            transparent 28%
        ),
        radial-gradient(
            circle at 0% 100%,
            rgba(14, 165, 233, 0.025),
            transparent 30%
        ),
        var(--spi-bg, #f8fafc);

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

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


/* ==========================================================
   MAIN
========================================================== */

.spi-main {
    flex: 1;

    min-width: 0;
    min-height: 100vh;

    margin-left: 270px;

    display: flex;
    flex-direction: column;

    position: relative;

    transition:
        margin-left 0.3s ease,
        width 0.3s ease;
}


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

.spi-content {
    flex: 1;

    width: 100%;

    padding: 34px 36px 40px;

    position: relative;
}


/* ==========================================================
   PAGE HEADER
========================================================== */

.spi-page-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 24px;

    margin-bottom: 30px;

    animation:
        spiDashboardFadeIn 0.55s ease both;
}


.spi-page-title {
    margin: 0 0 8px;

    font-size: 32px;
    line-height: 1.15;

    font-weight: 800;
    letter-spacing: -0.7px;

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


.spi-page-description {
    margin: 0;

    max-width: 650px;

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

    font-size: 14px;
    line-height: 1.7;
}


.spi-page-actions {
    display: flex;

    align-items: center;

    gap: 10px;

    flex-shrink: 0;
}


/* ==========================================================
   DASHBOARD GRID
========================================================== */

.spi-dashboard-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 18px;

    margin-bottom: 24px;
}


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

.spi-stat-card {
    position: relative;

    overflow: hidden;

    display: flex;

    align-items: center;

    gap: 18px;

    min-height: 136px;

    padding: 24px;

    border:
        1px solid rgba(226, 232, 240, 0.85);

    border-radius: 18px;

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

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

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

    animation:
        spiDashboardCardIn 0.55s cubic-bezier(.22, 1, .36, 1) both;
}


/* decorative glow */

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

    position: absolute;

    width: 120px;
    height: 120px;

    top: -70px;
    right: -60px;

    border-radius: 50%;

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

    pointer-events: none;

    transition:
        transform 0.35s ease,
        opacity 0.35s ease;
}


/* top highlight */

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

    position: absolute;

    left: 24px;
    right: 24px;

    top: 0;

    height: 1px;

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

    opacity: .9;
}


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

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

    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.075),
        0 4px 12px rgba(34, 197, 94, 0.045);
}


.spi-stat-card:hover::before {
    transform: scale(1.35);

    opacity: 1;
}


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

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

    flex-shrink: 0;

    display: flex;

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

    border-radius: 16px;

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

    border:
        1px solid rgba(226, 232, 240, 0.75);

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

    font-size: 24px;

    box-shadow:
        0 5px 15px rgba(15, 23, 42, 0.045);

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}


.spi-stat-card:hover .spi-stat-icon {
    transform: scale(1.06);

    box-shadow:
        0 8px 20px rgba(34, 197, 94, 0.10);
}


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

.spi-stat-content {
    min-width: 0;

    display: flex;

    flex-direction: column;

    gap: 8px;

    position: relative;

    z-index: 2;
}


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

    line-height: 1.4;

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

    font-weight: 600;

    letter-spacing: 0.1px;
}


.spi-stat-value {
    font-size: 28px;

    line-height: 1;

    font-weight: 800;

    letter-spacing: -0.6px;

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


/* ==========================================================
   DASHBOARD COLUMNS
========================================================== */

.spi-dashboard-columns {
    display: grid;

    grid-template-columns:
        minmax(0, 1.4fr)
        minmax(0, 1fr);

    gap: 22px;

    margin-bottom: 24px;
}


/* ==========================================================
   GENERIC DASHBOARD CARD
========================================================== */

.spi-dashboard-columns > .spi-card,
.spi-quick-actions,
.spi-stat-card {
    animation:
        spiDashboardCardIn 0.55s cubic-bezier(.22, 1, .36, 1) both;
}


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

.spi-card-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    padding: 22px 24px;

    border-bottom:
        1px solid rgba(226, 232, 240, 0.75);

    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.72),
            rgba(248,250,252,.35)
        );
}


.spi-card-title {
    margin: 0 0 5px;

    font-size: 16px;

    line-height: 1.4;

    font-weight: 750;

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

    letter-spacing: -0.1px;
}


.spi-card-description {
    margin: 0;

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

    font-size: 12px;

    line-height: 1.5;
}


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


/* ==========================================================
   CARD LINK / VIEW ALL
========================================================== */

.spi-card-header a,
.spi-card-header .spi-link {
    position: relative;

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

    font-size: 13px;

    font-weight: 700;

    text-decoration: none;

    transition:
        color .2s ease,
        transform .2s ease;
}


.spi-card-header a:hover,
.spi-card-header .spi-link:hover {
    color:
        var(--spi-primary-hover, #16a34a);

    transform: translateX(2px);
}


/* ==========================================================
   EMPTY STATE
========================================================== */

.spi-empty-state {
    min-height: 230px;

    display: flex;

    flex-direction: column;

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

    text-align: center;

    padding: 30px 20px;

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

    animation:
        spiEmptyStateIn 0.7s ease both;
}


.spi-empty-icon {
    width: 64px;
    height: 64px;

    margin-bottom: 16px;

    display: flex;

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

    border-radius: 18px;

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

    border:
        1px solid rgba(226, 232, 240, 0.8);

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

    font-size: 26px;

    transition:
        transform .3s ease,
        box-shadow .3s ease;
}


.spi-empty-state:hover .spi-empty-icon {
    transform:
        translateY(-3px)
        scale(1.04);

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


.spi-empty-state h4 {
    margin: 0 0 7px;

    font-size: 15px;

    line-height: 1.4;

    font-weight: 700;

    color:
        var(--spi-text, #334155);
}


.spi-empty-state p {
    margin: 0;

    max-width: 300px;

    font-size: 12px;

    line-height: 1.7;

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


/* ==========================================================
   QUICK ACTIONS
========================================================== */

.spi-quick-actions {
    margin-bottom: 24px;

    overflow: hidden;

    border-radius: 20px;

    background:
        rgba(255, 255, 255, 0.86);

    border:
        1px solid rgba(226, 232, 240, 0.82);

    box-shadow:
        0 8px 30px rgba(15, 23, 42, 0.035);

    backdrop-filter: blur(10px);
}


.spi-quick-actions .spi-card-header {
    padding: 24px 28px;
}


.spi-quick-action-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 14px;

    padding: 22px 28px 28px;
}


/* ==========================================================
   QUICK ACTION
========================================================== */

.spi-quick-action {
    position: relative;

    min-height: 112px;

    padding: 20px;

    display: flex;

    flex-direction: column;

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

    gap: 11px;

    border:
        1px solid rgba(226, 232, 240, 0.85);

    border-radius: 16px;

    color:
        var(--spi-text, #334155);

    text-decoration: none;

    font-size: 13px;

    font-weight: 650;

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #f8fafc
        );

    box-shadow:
        0 2px 5px rgba(15, 23, 42, 0.02);

    overflow: hidden;

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


.spi-quick-action::before {
    content: "";

    position: absolute;

    width: 90px;
    height: 90px;

    top: -50px;
    right: -40px;

    border-radius: 50%;

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

    transition:
        transform .35s ease;
}


.spi-quick-action:hover {
    border-color:
        rgba(34, 197, 94, 0.32);

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

    transform:
        translateY(-4px);

    box-shadow:
        0 12px 28px rgba(15, 23, 42, 0.065),
        0 4px 10px rgba(34, 197, 94, 0.055);
}


.spi-quick-action:hover::before {
    transform: scale(1.45);
}


/* ==========================================================
   QUICK ACTION ICON
========================================================== */

.spi-quick-action-icon {
    width: 44px;
    height: 44px;

    display: flex;

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

    border-radius: 13px;

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

    border:
        1px solid rgba(226, 232, 240, 0.8);

    font-size: 21px;

    transition:
        transform .28s ease,
        box-shadow .28s ease;
}


.spi-quick-action:hover .spi-quick-action-icon {
    transform:
        translateY(-2px)
        scale(1.05);

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


/* ==========================================================
   APP FOOTER
========================================================== */

.spi-app-footer {
    padding: 18px 36px;

    display: flex;

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

    gap: 20px;

    border-top:
        1px solid rgba(226, 232, 240, 0.75);

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

    font-size: 12px;

    background:
        rgba(255,255,255,.78);

    backdrop-filter: blur(10px);
}


/* ==========================================================
   SYSTEM ONLINE BADGE
========================================================== */

.spi-status,
.spi-system-status {
    display: inline-flex;

    align-items: center;

    gap: 8px;

    padding: 8px 13px;

    border-radius: 999px;

    background:
        rgba(34, 197, 94, 0.10);

    color:
        #15803d;

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

    font-size: 12px;

    font-weight: 700;
}


.spi-status::before,
.spi-system-status::before {
    content: "";

    width: 7px;
    height: 7px;

    border-radius: 50%;

    background:
        #22c55e;

    box-shadow:
        0 0 0 4px rgba(34, 197, 94, 0.10);

    animation:
        spiStatusPulse 2s ease-in-out infinite;
}


/* ==========================================================
   STAGGER ANIMATION
========================================================== */

.spi-dashboard-grid .spi-stat-card:nth-child(1) {
    animation-delay: .04s;
}

.spi-dashboard-grid .spi-stat-card:nth-child(2) {
    animation-delay: .09s;
}

.spi-dashboard-grid .spi-stat-card:nth-child(3) {
    animation-delay: .14s;
}

.spi-dashboard-grid .spi-stat-card:nth-child(4) {
    animation-delay: .19s;
}


.spi-dashboard-columns {
    animation:
        spiDashboardCardIn .55s .24s
        cubic-bezier(.22, 1, .36, 1)
        both;
}


.spi-quick-actions {
    animation:
        spiDashboardCardIn .55s .30s
        cubic-bezier(.22, 1, .36, 1)
        both;
}


/* ==========================================================
   KEYFRAMES
========================================================== */

@keyframes spiDashboardFadeIn {

    from {
        opacity: 0;

        transform:
            translateY(10px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }

}


@keyframes spiDashboardCardIn {

    from {
        opacity: 0;

        transform:
            translateY(16px)
            scale(.985);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }

}


@keyframes spiEmptyStateIn {

    from {
        opacity: 0;

        transform:
            translateY(8px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }

}


@keyframes spiStatusPulse {

    0%,
    100% {
        box-shadow:
            0 0 0 4px rgba(34, 197, 94, 0.10);
    }

    50% {
        box-shadow:
            0 0 0 7px rgba(34, 197, 94, 0.025);
    }

}


/* ==========================================================
   RESPONSIVE
========================================================== */

@media (max-width: 1200px) {

    .spi-content {
        padding:
            30px;
    }

    .spi-dashboard-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

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

}


@media (max-width: 1000px) {

    .spi-dashboard-columns {
        grid-template-columns:
            1fr;
    }

    .spi-quick-action-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 900px) {

    .spi-main {
        margin-left: 0;
    }

    .spi-content {
        padding:
            26px 24px 34px;
    }

    .spi-page-header {
        margin-bottom: 24px;
    }

    .spi-page-title {
        font-size: 28px;
    }

    .spi-dashboard-grid {
        gap: 16px;
    }

    .spi-dashboard-columns {
        gap: 18px;
    }

    .spi-app-footer {
        padding:
            17px 24px;
    }

}


@media (max-width: 640px) {

    .spi-content {
        padding:
            20px 16px 28px;
    }

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

        align-items: stretch;

        gap: 14px;
    }

    .spi-page-title {
        font-size: 25px;

        letter-spacing: -0.45px;
    }

    .spi-page-description {
        font-size: 13px;
    }

    .spi-page-actions {
        width: 100%;
    }

    .spi-dashboard-grid {
        grid-template-columns:
            1fr;

        gap: 14px;
    }

    .spi-stat-card {
        min-height: 116px;

        padding: 20px;
    }

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

        border-radius: 14px;

        font-size: 22px;
    }

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

    .spi-dashboard-columns {
        gap: 16px;

        margin-bottom: 18px;
    }

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

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

    .spi-empty-state {
        min-height: 200px;
    }

    .spi-quick-actions {
        border-radius: 17px;
    }

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

    .spi-quick-action-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 10px;

        padding:
            16px 18px 20px;
    }

    .spi-quick-action {
        min-height: 100px;

        padding: 15px;

        font-size: 12px;
    }

    .spi-quick-action-icon {
        width: 40px;
        height: 40px;

        font-size: 19px;
    }

    .spi-app-footer {
        padding:
            16px 18px;

        flex-direction: column;

        align-items: center;

        justify-content: center;

        text-align: center;

        gap: 7px;
    }

}


@media (max-width: 380px) {

    .spi-content {
        padding:
            18px 13px 24px;
    }

    .spi-stat-card {
        padding:
            17px;
        gap: 14px;
    }

    .spi-stat-icon {
        width: 46px;
        height: 46px;
    }

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

    .spi-quick-action-grid {
        gap: 8px;

        padding:
            14px;
    }

    .spi-quick-action {
        min-height: 94px;

        padding: 12px;
    }

}


/* ==========================================================
   ACCESSIBILITY
========================================================== */

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

    .spi-app *,
    .spi-app *::before,
    .spi-app *::after {
        animation-duration: 0.01ms !important;

        animation-iteration-count: 1 !important;

        transition-duration: 0.01ms !important;
    }

}