/* CONSTANTS & VARIABLES */
:root {
    --bg-card: #2f3231;
    --bg-body: #2d2d2d;
    --bg-card-header: #2c3034;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #373b3e;

    /* Status Colors */
    --color-running: #4caf50;
    --color-off: #ffc107;
    --color-alarm: #d50000;
    --color-mainten: #0dcaf0;
    --color-breakdown: #000000;
    --color-disconnect: #6c757d;
}

[data-theme="dark"] {
    --bg-card: #2f3231;
}

@font-face {
    font-family: "Kanit Bold";
    src: url(../font/Kanit/Kanit-Bold.ttf);
}

/* MAIN LAYOUT (GRID SYSTEM) */
.main-grid {
    display: grid;
    grid-template-areas:
        "mc-info mc-layout"
        "mc-info mc-gantt";
    grid-template-columns: 20% 79.5%;
    grid-template-rows: 75vh 10vh;
    grid-gap: 0.5rem;
}

.mc-info {
    grid-area: mc-info;
    background: var(--bg-card);
    border-radius: 0.3rem;
    padding: 0.5rem;
    overflow: hidden;
}

.mc-layout {
    grid-area: mc-layout;
    background: var(--bg-card);
    border-radius: 0.3rem;
    padding: 0.5rem;
}

.mc-gantt {
    grid-area: mc-gantt;
    background: var(--bg-card);
    border-radius: 0.3rem;
    padding: 0.5rem;
}

/* Layout Adjustments for 1080p */
@media screen and (height: 1080px) {
    .main-grid {
        grid-template-rows: 77vh 10vh;
    }
}

/* BASE COMPONENTS (CARDS) */
.card {
    width: 100%;
    height: 100%;
    border-radius: 0.3rem;
    border: 2px solid #464848;
    background: transparent;
}

.card-head {
    width: 100%;
    padding: 0.5rem;
    border-bottom: 2px solid #464848;
}

.card-head p {
    margin: 0rem;
    font-size: 1.3rem;
    color: #c7c7c7;
    font-family: "Kanit Bold";
}

.card-body {
    width: 100%;
    padding: 0.5rem;
}

/* Card Body Specifics */
.cbh-info {
    height: 85vh;
    overflow-y: hidden;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.cbh-perfom {
    height: 25.5vh;
}

@media screen and (height: 1080px) {
    .cbh-info {
        height: 87vh;
    }
}

/* MACHINE INFORMATION */
.main-cbh-info {
    display: grid;
    height: 25%;
    overflow-y: auto;
    overflow-x: hidden;
    grid-gap: 0.3rem;
    grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
}

.main-cbh-info-robot {
    display: grid;
    height: 30%;
    overflow-y: hidden;
    margin-bottom: 0.1rem;
    grid-gap: 0.2rem;
    grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
}

.card-main-cbh-info {
    background: #b7b7b7;
    border: 1px solid #b7b7b7;
    border-radius: 0.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 0.6rem;
    padding: 0.55rem 0.2rem;
    font-weight: bold;
}

.main-cbh-info-robot .card-main-cbh-info {
    font-size: 0.7rem;
    padding: 0.1rem;
}

.name-robot {
    color: #ffffff;
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0rem;
}

/* TABLES & SIDEBAR INFO */
.card-info-sidebar {
    color: #fff;
    padding: 1rem 1rem 0 1rem;
    border: 1px solid #4a4a4a;
    border-radius: 5px;
    margin-top: 10px;
    flex: 1;
}

.card-info-sidebar h2 {
    font-size: 1.3rem;
    color: #c7c7c7;
    font-family: "Kanit Bold";
    margin: 0 !important;
}

.card-info-table {
    height: auto;
    overflow-y: visible;
}

thead, tbody, tr, td, th {
    border: 1px solid #878787 !important;
    font-size: 0.8rem;
    text-align: center !important;
}

td {
    background-color: #3f3f3f !important;
}

tbody tr:hover {
    background-color: #7a7a7a !important;
}

.row-table {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.row-th {
    border: 1px solid #878787;
    padding: 8px;
    flex: 1;
    font-size: 0.8rem;
}

.row-th:nth-child(2) {
    display: flex;
    justify-content: center;
    background-color: #3f3f3f;
}

.conveyor-mini {
    margin-top: 20px;
}

/* MACHINE LAYOUT & CHARTS */
.card-layout {
    position: relative;
    width: 100vw;
    height: calc(100vw * 9 / 16);
    max-height: 100vh;
    max-width: calc(100vh * 16 / 9);
    margin: auto;
    overflow: hidden;
}

.highcharts-figure {
    width: 100%;
    position: relative;
}

#Time_Chart {
    position: absolute;
    width: 100%;
    height: 15rem;
    top: -1rem;
}

.cbh-perfom figure {
    height: 12rem;
}

@media screen and (height: 1080px) {
    #Time_Chart {
        height: 17rem;
    }

    .cbh-perfom figure {
        height: 14rem;
    }
}

.select-chart {
    display: none;
}

/* STATUS INDICATORS & ANIMATIONS */

/* Generic Status Backgrounds */
div[data-status="running"], .header-label-detail {
    background: #4caf50;
    color: #ffffff;
}

div[data-status="idle"] {
    background: #ffff01;
    color: #000000;
}

div[data-status="disconnect"] {
    background: #cccccc;
    color: #000000;
}

div[data-status="alarm"] {
    background: #ed1c24;
    color: #ffffff;
    animation: alarm 0.6s infinite alternate;
}

/* Data-Attribute Specific Status */
[status-type="bg_g"][data-status="st1"],
[status-type="bg"][data-status="st1"],
[status-type="bg_gr"][data-status="st0"],
[status-type="bg_rg"][data-status="st1"] {
    background: #4caf50;
    color: #414141;
    border: 1px solid #4caf50;
}

[status-type="bg_y"][data-status="st1"],
[status-type="bg"][data-status="st2"] {
    background: #ffff01;
    color: #414141;
    border: 1px solid #ffff01;
}

[status-type="bg_r"][data-status="st1"],
[status-type="bg"][data-status="st3"],
[status-type="bg_gr"][data-status="st1"],
[status-type="bg_rg"][data-status="st0"] {
    background: #fe0000;
    color: #ffffff;
    border: 1px solid #fe0000;
    animation: alarm 0.6s infinite alternate;
}

[status-type="bg_r"][data-status="st1"] div::before {
    border: 3px solid #fe0000;
}

/* DL/DD Status Labels */
dl[data-status="running"] dd .status {
    background: #4caf50;
    color: #ffffff;
}

dl[data-status="idle"] dd .status {
    background: #ffff01;
    color: #000000;
}

dl[data-status="disconnect"] dd .status {
    background: #cccccc;
    color: #000000;
}

dl[data-status="alarm"] dd .status {
    background: #ed1c24;
    color: #ffffff;
    animation: alarm 0.6s infinite alternate;
}

dl[data-status="running"] dd .status::before {
    content: "Running";
}

dl[data-status="idle"] dd .status::before {
    content: "Idle";
}

dl[data-status="alarm"] dd .status::before {
    content: "Alarm";
}

dl[data-status="disconnect"] dd .status::before {
    content: "Disconnect";
}

/* Legends */
.machine-legend {
    display: flex;
    position: absolute;
    bottom: 11rem;
    width: 100%;
    gap: 15px;
    padding: 4px 15px;
    font-size: 0.65rem;
    border-top: 1px solid #333;
    justify-content: flex-start;
    flex-wrap: wrap;
    z-index: 20;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #ccc;
}

.box-indicator {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

/* Animations */
@keyframes alarm {
    0% {
        background-color: #ed1c24;
    }

    100% {
        background-color: #ed1c2448;
    }
}

/* TYPOGRAPHY & MISC */
dt {
    color: #ffffff;
    margin-bottom: 0rem;
    padding-top: 0.2rem;
}

dd {
    margin-bottom: 0rem;
}

dd div span {
    font-style: italic;
    color: #aeaeae;
    font-size: 1rem;
    padding-right: 0rem !important;
}

/* SELECT2 CUSTOMIZATION */
.select2 {
    width: 30% !important;
    margin-top: 4px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #fff;
}

.select2-container--default .select2-selection--single {
    border-radius: 0 !important;
    border: 1px solid #f1f1f1;
    background-color: #1f1f1f !important;
    color: #fff !important;
}

.select2-container--default .select2-selection--multiple {
    background-color: #1f1f1f !important;
    border: 1px solid #333 !important;
    border-radius: 4px !important;
    max-height: 36px !important;
    overflow-y: auto;
    overflow-x: hidden;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #444 !important;
    border: 1px solid #555 !important;
    color: #fff !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    color: #bfbfbf !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__arrow {
    height: 34px !important;
}

.select2-dropdown {
    background-color: #1f1f1f !important;
    border: 1px solid #333 !important;
}

.select2-results__option {
    color: #dcdcdc !important;
    background-color: #1f1f1f !important;
}

.select2-results__option--highlighted {
    background-color: #333 !important;
    color: white !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
    color: #000;
}

.select2-container--default .select2-search--inline .select2-search__field {
    color: #fff;
}

/*  CUSTOM SCROLLBAR  */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

/* latar belakang scrollbar */
::-webkit-scrollbar-track {
    background: transparent;
}

/* Handle bagian yang digeser */
::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Khusus untuk Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #4a4a4a transparent;
}