﻿/* LOADER */
#wifi-loader {
    --background: #62abff;
    --front-color: #4f29f0;
    --back-color: #c3c8de;
    --text-color: #414856;
    width: 64px;
    height: 64px;
    border-radius: 50px;
    position: fixed;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    text-wrap: nowrap;
}

    #wifi-loader svg {
        position: absolute;
        display: flex;
        justify-content: center;
        align-items: center;
    }

        #wifi-loader svg circle {
            position: absolute;
            fill: none;
            stroke-width: 6px;
            stroke-linecap: round;
            stroke-linejoin: round;
            transform: rotate(-100deg);
            transform-origin: center;
        }

            #wifi-loader svg circle.back {
                stroke: var(--back-color);
            }

            #wifi-loader svg circle.front {
                stroke: var(--front-color);
            }

        #wifi-loader svg.circle-outer {
            height: 86px;
            width: 86px;
        }

            #wifi-loader svg.circle-outer circle {
                stroke-dasharray: 62.75 188.25;
            }

                #wifi-loader svg.circle-outer circle.back {
                    animation: circle-outer135 1.8s ease infinite 0.3s;
                }

                #wifi-loader svg.circle-outer circle.front {
                    animation: circle-outer135 1.8s ease infinite 0.15s;
                }

        #wifi-loader svg.circle-middle {
            height: 60px;
            width: 60px;
        }

            #wifi-loader svg.circle-middle circle {
                stroke-dasharray: 42.5 127.5;
            }

                #wifi-loader svg.circle-middle circle.back {
                    animation: circle-middle6123 1.8s ease infinite 0.25s;
                }

                #wifi-loader svg.circle-middle circle.front {
                    animation: circle-middle6123 1.8s ease infinite 0.1s;
                }

        #wifi-loader svg.circle-inner {
            height: 34px;
            width: 34px;
        }

            #wifi-loader svg.circle-inner circle {
                stroke-dasharray: 22 66;
            }

                #wifi-loader svg.circle-inner circle.back {
                    animation: circle-inner162 1.8s ease infinite 0.2s;
                }

                #wifi-loader svg.circle-inner circle.front {
                    animation: circle-inner162 1.8s ease infinite 0.05s;
                }

    #wifi-loader .text {
        position: absolute;
        bottom: -40px;
        display: flex;
        justify-content: center;
        align-items: center;
        font-weight: 500;
        font-size: 14px;
        letter-spacing: 0.2px;
    }

        #wifi-loader .text::before, #wifi-loader .text::after {
            content: attr(data-text);
        }

        #wifi-loader .text::before {
            color: var(--text-color);
        }

        #wifi-loader .text::after {
            color: var(--front-color);
            animation: text-animation76 3.6s ease infinite;
            position: absolute;
            left: 0;
        }

@keyframes circle-outer135 {
    0% {
        stroke-dashoffset: 25;
    }

    25% {
        stroke-dashoffset: 0;
    }

    65% {
        stroke-dashoffset: 301;
    }

    80% {
        stroke-dashoffset: 276;
    }

    100% {
        stroke-dashoffset: 276;
    }
}

@keyframes circle-middle6123 {
    0% {
        stroke-dashoffset: 17;
    }

    25% {
        stroke-dashoffset: 0;
    }

    65% {
        stroke-dashoffset: 204;
    }

    80% {
        stroke-dashoffset: 187;
    }

    100% {
        stroke-dashoffset: 187;
    }
}

@keyframes circle-inner162 {
    0% {
        stroke-dashoffset: 9;
    }

    25% {
        stroke-dashoffset: 0;
    }

    65% {
        stroke-dashoffset: 106;
    }

    80% {
        stroke-dashoffset: 97;
    }

    100% {
        stroke-dashoffset: 97;
    }
}

@keyframes text-animation76 {
    0% {
        clip-path: inset(0 100% 0 0);
    }

    50% {
        clip-path: inset(0);
    }

    100% {
        clip-path: inset(0 0 0 100%);
    }
}

.main-loader {
    height: 140px;
    aspect-ratio: 1;
    position: relative;
    --g: /calc(30.259% + 5.027px) calc(30.259% + 5.027px) radial-gradient(#0000 calc(70% - 8px),#000 calc(71% - 8px) 70%,#0000 71%) no-repeat;
    mask: radial-gradient(100% 100%,#000 calc((30.259% + 5.027px)/0.964 - 8.306px),#0000 calc((30.259% + 5.027px)/0.964 - 8.306px + 1px)) intersect,100% 50% var(--g),81.174% 89.092% var(--g),38.874% 98.746% var(--g),4.952% 71.694% var(--g),4.952% 28.306% var(--g),38.874% 1.254% var(--g),81.174% 10.908% var(--g);
    filter: blur(12px);
}

    .main-loader:before {
        content: "";
        position: absolute;
        inset: 0;
        background: conic-gradient(#0000 35%,#FA6900,#0000 65%);
        animation: l10 2s linear infinite;
    }

@keyframes l10 {
    to {
        rotate: 1turn
    }
}
/* END LOADER */

.disable-Left {
    left: 10px !important;
}

.custom-instructions-content {
    line-height: 1.6;
}

    .custom-instructions-content ul,
    .custom-instructions-content ol {
        margin-left: 1.5rem;
    }

    .custom-instructions-content h1,
    .custom-instructions-content h2,
    .custom-instructions-content h3,
    .custom-instructions-content h4,
    .custom-instructions-content h5 {
        margin-top: 0.75rem;
        margin-bottom: 0.5rem;
        font-weight: 600;
    }

    .custom-instructions-content code {
        background-color: rgba(0, 0, 0, 0.05);
        padding: 0.2rem 0.4rem;
        border-radius: 3px;
        font-family: 'Courier New', monospace;
    }

    .custom-instructions-content pre {
        background-color: rgba(0, 0, 0, 0.05);
        padding: 1rem;
        border-radius: 4px;
        overflow-x: auto;
    }

    .custom-instructions-content a {
        color: var(--mud-palette-primary);
        text-decoration: underline;
    }

    .custom-instructions-content img {
        max-width: 100%;
        height: auto;
    }

/* Dashboard Grid Layout */
/* Widget Group Borders */
.widget-group-border {
    pointer-events: none;
    border-radius: 8px;
    position: relative;
    z-index: 5;
    box-sizing: border-box;
    margin: 0;
}

/* Title base */
.widget-group-title {
    position: absolute;
    z-index: 6;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    pointer-events: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    /* Variant 1: Chip overlapping border (default) */
    .widget-group-title.chip {
        top: 0;
        left: 12px;
        transform: translateY(-50%);
        background: var(--mud-palette-surface);
        padding: 6px 12px;
        margin-top: 0;
        border-radius: 16px;
        box-shadow: 0 0 0 1px var(--mud-palette-primary), 0 2px 4px rgba(0,0,0,.08);
    }

    /* Variant 2: Ribbon */
    .widget-group-title.ribbon {
        top: 0;
        left: 0;
        transform: translateY(-0%);
        background: linear-gradient(90deg, var(--mud-palette-primary) 0%, var(--mud-palette-primary-darken) 100%);
        color: var(--mud-palette-white);
        padding: 4px 20px 6px 14px;
        border-end-end-radius: 26px;
        border-start-start-radius: 6px;
        clip-path: polygon(0 0, 100% 0, 94% 100%, 0% 100%);
        font-weight: 600;
    }

    /* Variant 3: Bar inside top edge */
    .widget-group-title.bar {
        top: 0;
        left: 0;
        right: 0;
        transform: translateY(0);
        background: var(--mud-palette-surface);
        padding: 10px 16px;
        border-bottom: 1px solid var(--mud-palette-primary);
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
    }

/* Optional subtle fade behind widgets for groups */
.widget-group-border.with-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(0,0,0,.04), rgba(0,0,0,.02));
    border-radius: inherit;
    z-index: 5;
    pointer-events: none;
}

.dashboard-grid {
    display: grid;
    width: 100%;
    overflow: hidden;
}

.dashboard-grid-item {
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    z-index: 1;
    position: relative;
}

/* Dashboard Widget Containers */
.widget-container {
    height: 100%;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 16px;
}

.widget-wrapper {
    height: 100%;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    justify-content: center;
    min-width: 0;
}

/* Base Widget Styles - All widgets should extend these */
.base-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.widget-title {
    flex-shrink: 0;
    margin-bottom: 8px;
    font-weight: 600;
    text-align: center;
}

.widget-content {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* Chart Widget Specific */
.chart-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.chart-widget-title {
    flex-shrink: 0;
    text-align: center;
    font-weight: 600;
    margin-bottom: 8px;
}

.chart-widget-content {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

    .chart-widget-content .mud-chart {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-evenly !important;
        overflow: hidden !important;
    }

    .chart-widget-content .mud-chart-pie,
    .chart-widget-content .mud-chart-donut {
        max-width: 60% !important;
        max-height: 100% !important;
        flex-shrink: 1;
        min-height: 0;
    }

        .chart-widget-content .mud-chart-pie svg,
        .chart-widget-content .mud-chart-donut svg {
            max-width: 100% !important;
            max-height: 100% !important;
            height: auto !important;
            width: auto !important;
        }

    .chart-widget-content .mud-chart-legend {
        max-width: 35% !important;
        max-height: 100% !important;
        overflow-y: auto;
        overflow-x: hidden;
        font-size: 0.75rem !important;
        padding: 4px 8px;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: 4px;
        flex-shrink: 0;
    }

    .chart-widget-content .mud-chart-legend-item {
        margin: 0 !important;
        padding: 2px 4px;
        font-size: 0.75rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

/* Line Chart Specific - Legend at Bottom */
.line-chart-widget .chart-widget-content .mud-chart {
    flex-direction: column !important;
}

.line-chart-widget .chart-widget-content .mud-chart-line {
    max-width: 100% !important;
    max-height: 80% !important;
    flex: 1;
    min-height: 0;
}

    .line-chart-widget .chart-widget-content .mud-chart-line svg {
        max-width: 100% !important;
        max-height: 100% !important;
        height: auto !important;
        width: auto !important;
    }

.line-chart-widget .chart-widget-content .mud-chart-legend {
    max-width: 100% !important;
    max-height: 20% !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center !important;
    align-items: center;
    overflow-y: hidden;
    overflow-x: auto;
}

/* Table Widget */
.table-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.table-widget-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

    .table-widget-content .mud-data-grid {
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

        .table-widget-content .mud-data-grid .mud-table-toolbar {
            flex-shrink: 0;
        }

        .table-widget-content .mud-data-grid .mud-table-container {
            flex: 1 !important;
            min-height: 0 !important;
            overflow-y: auto !important;
            overflow-x: auto !important;
        }

        .table-widget-content .mud-data-grid .mud-table-pager {
            flex-shrink: 0;
        }

    .table-widget-content .mud-table {
        height: 100%;
    }

/* List Widget */
.list-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.list-widget-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Metric Card Widget */
.metric-card-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    text-align: center;
    overflow: hidden;
}

.metric-value {
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
}

.metric-label {
    font-size: clamp(0.875rem, 2vw, 1.125rem);
    margin-top: 8px;
    opacity: 0.8;
}

/* Responsive Grid Breakpoints */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        grid-template-rows: auto !important;
        height: auto !important;
    }

    .dashboard-grid-item {
        grid-column: auto / span 4 !important;
        grid-row: auto !important;
        min-height: 300px;
    }

    /* Hide group borders on tablet/mobile - groups will stack naturally */
    .widget-group-border {
        display: none;
    }

    .widget-container {
        padding: 12px;
    }

    .chart-widget-content .mud-chart-legend,
    .chart-widget-content .mud-chart-legend-item {
        font-size: 0.7rem !important;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .dashboard-grid-item {
        grid-column: auto / span 2 !important;
        min-height: 250px;
    }
}

@media (max-width: 600px) {
    .widget-container {
        padding: 8px;
    }

    .chart-widget-content .mud-chart-legend {
        font-size: 0.65rem !important;
        gap: 2px;
    }

    .chart-widget-content .mud-chart-legend-item {
        font-size: 0.65rem !important;
    }

    .metric-value {
        font-size: clamp(1.25rem, 4vw, 2rem);
    }

    .metric-label {
        font-size: clamp(0.75rem, 1.5vw, 1rem);
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-grid-item {
        grid-column: auto / span 1 !important;
        min-height: 200px;
    }
}
