/* ================= ROOT & GLOBAL ================= */
:root {
    --primary-blue: #00d2ff;
    --dark-blue: #0056b3;
    --green: #00ff88;
    --glass: rgba(255, 255, 255, 0.35);
    --border: rgba(255, 255, 255, 0.5);
    --danger: #ff4646;
    --text-dark: #003366;
    --warning: #ffa000;
}

body { 
    margin: 0; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    color: var(--text-dark); 
    background: #e1f5fe;
    background-image: linear-gradient(rgba(225, 245, 254, 0.85), rgba(225, 245, 254, 0.85)), url('logo.png');
    background-repeat: no-repeat; 
    background-position: center; 
    background-attachment: fixed; 
    background-size: contain;
    min-height: 100vh; 
    overflow-x: hidden;
}

/* ================= CONTAINERS ================= */
.container { max-width: 480px; margin: auto; padding: 20px; opacity: 0; transform: translateY(20px); transition: all 1s ease; }
.container.loaded { opacity: 1; transform: translateY(0); }

.glass { 
    background: var(--glass); 
    backdrop-filter: blur(15px); 
    border: 1px solid var(--border); 
    border-radius: 22px; 
    box-shadow: 0 8px 32px rgba(0, 150, 255, 0.1); 
    padding: 20px; 
    margin-bottom: 15px;
}

/* ================= HEADER & BATTERY ================= */
.header { text-align: center; position: relative; padding-top: 10px; }
.header-logo { width: 50px; }
.brand-name { font-weight: 900; letter-spacing: 2px; color: var(--dark-blue); }
#date-display { font-size: 10px; color: #546e7a; font-weight: bold; margin-top: 5px; }
#clock { font-size: 11px; font-family: monospace; color: #0277bd; }

.battery-container { position: absolute; top: 15px; right: 20px; display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: bold; }
.bat-shell { width: 25px; height: 12px; border: 2px solid var(--dark-blue); border-radius: 3px; position: relative; padding: 1px; }
.bat-level { height: 100%; background: var(--green); width: 100%; transition: 0.5s; }
.bat-shell::after { content: ''; position: absolute; right: -4px; top: 2px; width: 2px; height: 4px; background: var(--dark-blue); border-radius: 0 1px 1px 0; }

/* ================= TABS & BUTTONS ================= */
.nav-tabs { display: flex; gap: 8px; margin-bottom: 15px; }
.tab-btn { flex: 1; padding: 12px 5px; border: none; border-radius: 15px; background: rgba(255,255,255,0.6); color: var(--dark-blue); cursor: pointer; font-weight: 700; font-size: 12px; transition: 0.3s; }
.tab-btn.active { background: var(--primary-blue); color: white; box-shadow: 0 4px 12px rgba(0, 210, 255, 0.3); }
.btn-start { width: 100%; margin-top: 10px; padding: 15px; font-size: 14px; }
.btn-download { width:100%; margin-top:15px; padding: 12px; }


.table-scroll {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 8px;
    margin-bottom: 10px;
}

/* ================= HOME PAGE ================= */
.home-title { font-size: 26px; font-weight: 900; color: var(--dark-blue); margin-bottom: 5px; display: flex; align-items: center; gap: 10px; }
.home-subtitle { font-size: 14px; font-weight: 700; color: var(--dark-blue); opacity: 0.8; margin-bottom: 15px; text-transform: uppercase; }
.home-tagline { font-size: 16px; font-weight: 800; color: #0277bd; margin-bottom: 15px; line-height: 1.3; }
.home-desc { font-size: 13.5px; line-height: 1.6; text-align: justify; color: #37474f; margin-bottom: 15px; }
.feature-list { list-style: none; padding: 0; margin-bottom: 20px; }
.feature-list li { font-size: 13px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; color: #455a64; }

/* ================= MONITOR PAGE ================= */
.time-info { font-size: 10px; text-align: center; color: var(--dark-blue); margin-bottom: 10px; font-weight: bold;}
.selection { display: flex; justify-content: space-around; padding: 10px; }
.animal { text-align: center; cursor: pointer; opacity: 0.5; transition: 0.4s; }
.animal img { width: 65px; height: 65px; border-radius: 50%; border: 3px solid white; object-fit: cover; }
.animal.active { opacity: 1; transform: scale(1.1); }
.animal-label { margin-top: 5px; font-size: 10px; font-weight: bold; }

.card { display: flex; justify-content: space-between; align-items: center; padding: 15px; }
.value { font-size: 22px; font-weight: 900; color: var(--dark-blue); }
.status { text-align: center; padding: 12px; border-radius: 15px; font-weight: 800; font-size: 11px; }
.safe { background: #c8e6c9; color: #1b5e20; }
.alert { background: #ffcdd2; color: #b71c1c; }
.standby { background: #e3f2fd; color: #01579b; }

.diag-box { margin-top: 15px; padding: 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; display: none; }
.diag-alert { background: #ffebee; border: 1px solid var(--danger); color: #b71c1c; display: block; }
.diag-normal { background: #e8f5e9; border: 1px solid #4caf50; color: #1b5e20; display: block; }

/* ================= HISTORY PAGE ================= */
.table-scroll { max-height: 250px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th, td { padding: 8px; text-align: left; border-bottom: 1px solid rgba(0,0,0,0.05); }

/* ================= LOADER & MODAL ================= */
#loader-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #e0f7fa; display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 30000;
    transition: 0.8s;
}
.loader-bar-container { width: 150px; height: 4px; background: rgba(0,0,0,0.1); margin-top: 20px; border-radius: 10px; overflow: hidden; }
.loader-bar { width: 0%; height: 100%; background: var(--primary-blue); animation: progress 2.5s forwards; }
@keyframes progress { to { width: 100%; } }

#verify-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0, 51, 102, 0.5); backdrop-filter: blur(8px); 
    display: none; justify-content: center; align-items: center; z-index: 20000;
}

.page { display: none; }
.page.active { display: block; }
