/**
 * Copyright 2026 ariefsetyonugroho
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     https://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* ROOT */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}

/* ================= LOGIN ================= */
.login-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center; 
    align-items: center;
    background: #f0f0f0;
    z-index: 9999;
}
.login-card {
    width: 350px;
    background: white;
    padding: 30px 25px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    animation: fadeIn 0.4s ease-in-out;
    max-width: 100%;
    margin: 20px;
}

.title {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.input-group {
    margin-bottom: 15px;
    position: relative;
    width: 100%;
}

.input-group input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 15px;
    outline: none;
    transition: 0.2s;
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: #2193b0;
    box-shadow: 0 0 5px rgba(33,147,176,0.3);
}

.input-group i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: #777;
    font-size: 16px;
}

button {
    display: block;        
    margin: 20px auto 0;   
    padding: 12px 30px;

    background: #2193b0;
    border: none;
    color: white;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

button:hover {
    background: #1a7d95;
}

.error {
    margin-top: 12px;
    padding: 10px;
    background: #ffdddd;
    border-left: 5px solid #ff4d4d;
    border-radius: 5px;
    color: #b30000;
    display: none;
}

/* ================= HEADER ================= */
.header {
    background: #1e1e2f;
    color: white;
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header .title {
    font-size: 20px;
    font-weight: bold;
    color: white;
}

.header-actions {
    display: flex;
    gap: 10px; 
}

#history-btn {
    padding: 5px 10px;
    font-size: 14px;
    background-color: #ffc107;
    color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#history-btn:hover {
    background-color: #e0a800;
    color: white;
}

.logout-btn {
    background: #e63946;
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
}

/* ================= CONTENT ================= */
.content-container {
    flex: 1; 
    display: flex;
    flex-direction: column;
    padding: 20px 40px;
    width: 100%;
}

.info-panel {
    flex: 1;
    display: flex;
}

/* =========================
   DASHBOARD CONTAINER
========================= */
.iot-dashboard {
    padding: 20px 40px;
    color: #fff;
    width: 100%;
    margin: 0; 
}

/* =========================
   HEADER
========================= */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-header h2 {
    margin: 0;
    font-weight: 600;
}

.status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    color: #fff;
}

/* =========================
   GRID (FULL 4 BOX)
========================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
    width: 100%;
}

/* =========================
   BOX METRIC
========================= */
.box {
    height: 220px;
    background: linear-gradient(135deg, #1e1e2f, #2c2c3e);
    border-radius: 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: 0.3s ease;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    width: 100%;
}

.box:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}

.box span {
    font-size: 14px;
    color: #aaa;
}

.box h1 {
    margin: 10px 0;
    font-size: 36px;
    font-weight: bold;
}

.box small {
    color: #888;
}

/* =========================
   FOOTER
========================= */
.dashboard-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #1e1e2f;
}

/* ACTION BUTTON */
.history-actions {
    display: flex;
    gap: 10px;
    padding: 20px 40px;
}

.btn-export {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
}

/* TABLE */
#history-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0; 
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

#history-table th {
    background: #1e1e2f;
    color: white;
    padding: 12px;
    text-align: left;
}

#history-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

#history-table tr:hover {
    background: #f1f1f1;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

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

    .dashboard-footer {
        flex-direction: column;
        gap: 5px;
    }
}