/* 基礎樣式 */
:root {
    --primary-gradient: linear-gradient(90deg, #51ccc9, #1c9afe);
    --secondary-gradient: linear-gradient(90deg, #3ED5D7, #2496E6);
    --border-radius: 0.625rem;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}

html {
    position: relative;
    height: 100%;
    font-size: 16px;
}

body {
    margin-bottom: 3.75rem; /* 60px */
    background: #fff;
}

/* 滾動條 */
::-webkit-scrollbar {
    width: 0.2rem;
    height: 0.2rem;
}

::-webkit-scrollbar-track {
    box-shadow: inset 0 0 0.3125rem grey;
    border-radius: var(--border-radius);
}

::-webkit-scrollbar-thumb {
    background: #2496e6;
    border-radius: var(--border-radius);
}

/* 元件樣式 */
.btn {
    border-radius: var(--border-radius);
}

    .btn:focus,
    .btn:active:focus,
    .btn-link.nav-link:focus,
    .form-control:focus,
    .form-check-input:focus {
        box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem #258cfb;
    }

.btn-primary {
    color: #fff;
    background: var(--primary-gradient);
    border-color: #1c9afe;
    box-shadow: var(--shadow-md);
}

    .btn-primary:hover,
    .btn-primary:focus,
    .btn-primary:active {
        box-shadow: 0 0.875rem 1.625rem -0.75rem rgba(28, 154, 254, 0.42), 0 0.25rem 1.4375rem 0 rgba(0, 0, 0, 0.12), 0 0.5rem 0.625rem -0.3125rem rgba(28, 154, 254, 0.2);
    }

.btn-outline-blue {
    color: #000;
    background: #fff;
    border: 1px solid #229DFE;
    min-width: 4rem;
    display: flex;
    justify-content: center;
}

    .btn-outline-blue:hover,
    .btn-check:checked + .btn-outline-blue,
    .btn-check:active + .btn-outline-blue,
    .btn-outline-blue:active,
    .btn-outline-blue.active,
    .btn-outline-blue.dropdown-toggle.show {
        color: #fff;
        background: var(--secondary-gradient);
        border-color: #229DFE;
    }

.btn-circle.btn-sm {
    width: 1.875rem;
    height: 1.75rem;
    padding: 0.375rem;
    border-radius: 50%;
    font-size: 0.5rem;
    text-align: center;
    border: none;
    color: #fff;
}

.card {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.card-info-div {
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-md);
}

    .card-info-div p {
        margin-bottom: 0;
    }

.dropdown-menu {
    border-radius: var(--border-radius);
}

    .dropdown-menu .dropdown-item:hover,
    .dropdown-menu .dropdown-item:focus,
    .dropdown-menu a:hover,
    .dropdown-menu a:focus,
    .dropdown-menu a:active {
        border-radius: var(--border-radius);
        box-shadow: var(--shadow-sm);
        background: var(--primary-gradient);
        color: #fff;
    }

    .dropdown-menu .line-notify a:hover {
        box-shadow: none;
        background: #2496e6;
        color: #666;
    }

.form-select,
.input-group-text,
input[type="date"],
input[type="time"],
input[type="month"],
input[type="number"],
#siteForm input[type="text"],
#siteForm input[type="email"] {
    border-radius: 0.5rem;
}

#siteForm input[type="date"],
#siteForm input[type="time"],
#siteForm input[type="month"],
#siteForm input[type="number"],
#siteForm input[type="text"],
#siteForm input[type="email"] {
    border-radius: 0 0.5rem 0.5rem 0;
}

.modal {
    z-index: 9999;
}

.modal-header {
    background: var(--primary-gradient);
    padding: 0.5rem 1rem;
    color: #fff;
}

.navbar-style {
    border: 1px solid #00000030;
    border-radius: 2rem;
    margin: 0.5rem;
    padding: 0.5rem;
}

.nav-tabs .nav-link {
    padding: 0.4286em 0.8575em;
    white-space: nowrap;
}

    .nav-tabs .nav-link.active,
    .nav-tabs .nav-link.active:hover,
    .nav-tabs .nav-link.active:focus {
        border-color: #2993dd;
        color: #2b92dc;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
    }

.tabbable .nav-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
}

#device_list .nav-link,
.nav-deivce .nav-link {
    border-radius: var(--border-radius);
    border: 1px solid;
    margin: 0.2rem 0 0 1rem;
    padding: 0;
    width: 80%;
}

.table thead th {
    background: #3ed5d7;
    color: #fff;
}

.accordion-button {
    border: 1px solid #ddd;
    border-radius: 0.375rem 0.375rem 0 0;
    padding: 0;
}

.carousel-div,
.energy-usage-div {
    height: 50vh;
}

.carousel-control-prev,
.carousel-control-next {
    height: 50%;
    top: 25%;
}

.carousel-control-prev {
    left: 0%;
}

.carousel-control-next {
    right: -3%;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-image: none;
}

.carousel-control-prev-icon::after,
.carousel-control-next-icon::after {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.carousel-control-prev-icon::after {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill('%23cccccc' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E");
}

.carousel-control-next-icon::after {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23cccccc' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l4 4-4 4-1.5-1.5 2.5-2.5-2.5-2.5L2.75 0z'/%3E%3C/svg%3E");
}
.carousel-item, .carousel-item img {
    width: 100%; /* 保持 Bootstrap 的 w-100 效果 */
    height: 100%; /* 讓圖片填滿 carousel-item 的高度 */
    object-fit: fill; /* 確保圖片內容完整顯示，不裁剪，並在容器內置中 */
    /* 或者 object-fit: cover; 如果您希望圖片填滿整個空間並允許裁剪 */
}
.scroll-to-top {
    display: none;
    position: fixed;
    bottom: 5rem;
    right: 1.875rem;
    width: 1.875rem;
    height: 1.875rem;
    background: var(--secondary-gradient);
    color: #fff;
    border: none;
    border-radius: 50%;
    padding: 0.125rem 0;
    text-align: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 0 0.625rem rgba(0, 0, 0, 0.5);
}

.scroll-to-top:hover {
    background: #111;
}

.loading-spinner {
    width: 5rem;
    height: 5rem;
    border: 0.5rem solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #50cbca;
    animation: spin 1s linear infinite, colorChange 1s linear infinite;
}

.loading-text {
    margin-top: 1.25rem;
    font-size: 1.2em;
    font-weight: bold;
    background: var(--primary-gradient);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textColorChange 3s linear infinite;
}

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.material-icons {
    font-size: 1rem;
}

h5 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

label {
    color: #000;
}

.bg-fy {
    background: var(--secondary-gradient);
}

.am5exporting ul {
    border-radius: 0.6rem;
}

.container-fluid {
    background: #fff;
    z-index: 9999;
}

.analysis-content {
    height: 67vh;
}

/* 動畫 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes colorChange {
    0% {
        border-top-color: #50cbca;
    }

    25% {
        border-top-color: #3bc4d2;
    }

    50% {
        border-top-color: #27b0e6;
    }

    75% {
        border-top-color: #1c99fe;
    }

    100% {
        border-top-color: #50cbca;
    }
}

@keyframes textColorChange {
    to {
        background-position: 100% 0;
    }
}

@keyframes marquee {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* RWD */
@media (max-width: 992px) {
    .carousel-div {
        height: 55vh;
    }

    .energy-usage-div {
        height: 52vh;
    }
}

@media (max-width: 768px) {
    .carousel-div {
        height: 80vh;
    }

    .energy-usage-div {
        height: 78vh;
    }
}

@media (max-width: 576px) {
    html {
        font-size: 14px;
    }

    .carousel-div {
        height: 30vh;
    }

    .energy-usage-div {
        height: 70vh;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
    }

    .table {
        display: block;
        width: 100%;
        margin: 0;
    }

    .table tr {
        display: inline-table;
        width: 100%;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        padding: 0.5rem;
        box-sizing: border-box;
    }

    .table td {
        display: block;
        text-align: left;
        width: 100%;
    }

    .table td:before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        width: 40%;
    }

    .table th:nth-child(2),
    .table td:nth-child(2) {
        display: none;
    }
}
