/* ====================================================
   COMMON.CSS - CSS dùng chung cho tất cả trang
   Dự án: Quản Lý Dự Án IoT - Bộ Lọc Chủ Động 1 Pha
   ==================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
    --primary-dark: #0d2d1e;
    --primary-light: #185a3c;
    --accent-green: #00e676;
    --bg-color: #ecf2ef;
    --card-bg: #ffffff;
    --text-dark: #1d2d24;
    --text-muted: #5a7064;
    --border-color: #1b4b36;
    --shadow-sm: 0 4px 12px rgba(13, 45, 30, 0.05);
    --shadow-md: 0 8px 24px rgba(13, 45, 30, 0.09);
    --shadow-lg: 0 14px 35px rgba(13, 45, 30, 0.14);
}

/* --- Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- Body & HTML --- */
body,
html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    overflow: hidden;
    display: flex;
    color: var(--text-dark);
}

/* ================= SIDEBAR ================= */
.sidebar {
    width: 230px;
    background: linear-gradient(180deg, #0d2d1e 0%, #092015 100%);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 4px solid var(--accent-green);
    flex-shrink: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.logo-container {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.logo-container i {
    font-size: 42px;
    color: var(--accent-green);
    filter: drop-shadow(0 0 12px rgba(0, 230, 118, 0.5));
    transition: transform 0.3s ease;
}

.logo-container i:hover {
    transform: rotate(15deg) scale(1.08);
}

.menu {
    list-style: none;
    padding: 15px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu li {
    padding: 13px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #c9e4d6;
}

.menu li i {
    width: 26px;
    font-size: 17px;
    color: #88c9a6;
    transition: color 0.25s ease, transform 0.25s ease;
}

.menu li:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(4px);
}

.menu li:hover i {
    color: var(--accent-green);
    transform: scale(1.15);
}

.menu li.active {
    background: linear-gradient(90deg, rgba(0, 230, 118, 0.22) 0%, rgba(0, 230, 118, 0.05) 100%);
    color: #ffffff;
    border-left: 4px solid var(--accent-green);
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.12);
}

.menu li.active i {
    color: var(--accent-green);
    filter: drop-shadow(0 0 6px rgba(0, 230, 118, 0.6));
}

/* ================= MAIN CONTENT ================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    background: radial-gradient(circle at 90% 10%, rgba(27, 75, 54, 0.04) 0%, transparent 60%);
}

/* ================= HEADER ================= */
header {
    background: linear-gradient(90deg, #0f3423 0%, #174a32 100%);
    color: white;
    padding: 14px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    border-bottom: 2px solid rgba(0, 230, 118, 0.35);
    box-shadow: 0 4px 15px rgba(13, 45, 30, 0.12);
}

.header-title {
    text-align: center;
    flex: 1;
}

.header-title h1 {
    font-size: 21px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 2px;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-title p {
    font-size: 12.5px;
    color: #a8e6cf;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 13px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.header-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.4);
}

/* ================= COMMON CARD ================= */
.card {
    background-color: var(--card-bg);
    border: 1px solid rgba(27, 75, 54, 0.16);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(0, 230, 118, 0.45);
}

.card-title {
    text-align: center;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 12px;
    font-size: 14px;
    letter-spacing: 0.6px;
    color: var(--primary-dark);
    flex-shrink: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: -4px;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ================= STATUS CARD (Bật/Tắt & Cảnh Báo) ================= */
.status-card {
    flex-shrink: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f7fbf9 100%);
    border: 1px solid rgba(0, 230, 118, 0.28);
    box-shadow: 0 6px 20px rgba(13, 45, 30, 0.08);
}

.status-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 35px;
    padding: 6px 10px;
    flex-wrap: wrap;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 13.5px;
    text-transform: uppercase;
    color: var(--primary-dark);
    letter-spacing: 0.8px;
}

.divider {
    width: 2px;
    height: 38px;
    background: linear-gradient(180deg, transparent 0%, #cbdcd2 50%, transparent 100%);
    border-radius: 2px;
}

/* --- Switch Toggle --- */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

input:checked+.slider {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.6), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* --- Status Grid --- */
.status-grid {
    display: flex;
    gap: 28px;
    font-size: 12.5px;
    flex-wrap: wrap;
    align-items: center;
}

.status-item {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(27, 75, 54, 0.1);
    transition: all 0.25s ease;
}

.status-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 230, 118, 0.4);
}

.status-item i {
    font-size: 18px;
    padding: 7px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-green {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.icon-blue {
    color: #0ea5e9;
    background: rgba(14, 165, 233, 0.12);
}

.icon-red {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.status-text strong {
    display: block;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ====================================================
   ECO-ENVIRONMENT STINGER TRANSITION (Hiệu ứng chuyển cảnh Môi trường Xanh)
   ==================================================== */
.eco-stinger-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    pointer-events: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eco-stinger-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateX(-101%);
    will-change: transform;
}

.eco-stinger-wave.wave-1 {
    background: #0f2b1d;
    z-index: 1;
}

.eco-stinger-wave.wave-2 {
    background: #1b4b36;
    z-index: 2;
}

.eco-stinger-wave.wave-3 {
    background: linear-gradient(135deg, #0d5c3a 0%, #1fa25a 50%, #28a745 100%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 50px rgba(15, 43, 29, 0.8);
}

.eco-stinger-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 4;
    text-align: center;
    padding: 22px 45px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

.eco-stinger-icons {
    font-size: 40px;
    margin-bottom: 10px;
    color: #a8e6cf;
    display: flex;
    gap: 15px;
    align-items: center;
    filter: drop-shadow(0 0 12px rgba(168, 230, 207, 0.7));
}

.eco-stinger-icons i {
    animation: ecoPulse 1.4s infinite alternate ease-in-out;
}

.eco-stinger-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.eco-stinger-subtext {
    font-size: 12px;
    color: #d1f2e0;
    margin-top: 5px;
    letter-spacing: 1px;
    font-weight: 500;
}

@keyframes ecoPulse {
    0% { transform: scale(1) translateY(0); }
    100% { transform: scale(1.15) translateY(-4px); }
}

/* Các trạng thái hoạt hình (Animation States) */
/* 1. Trạng thái Đang phủ vào (Sweep In) */
.eco-stinger-overlay.is-entering .eco-stinger-wave.wave-1 {
    transition: transform 0.45s cubic-bezier(0.77, 0, 0.175, 1) 0s;
    transform: translateX(0);
}

.eco-stinger-overlay.is-entering .eco-stinger-wave.wave-2 {
    transition: transform 0.45s cubic-bezier(0.77, 0, 0.175, 1) 0.08s;
    transform: translateX(0);
}

.eco-stinger-overlay.is-entering .eco-stinger-wave.wave-3 {
    transition: transform 0.45s cubic-bezier(0.77, 0, 0.175, 1) 0.16s;
    transform: translateX(0);
}

.eco-stinger-overlay.is-entering .eco-stinger-content {
    opacity: 1;
    transform: scale(1);
    transition-delay: 0.28s;
}

/* 2. Trạng thái Mở ra (Sweep Out - Reveal trang mới) */
.eco-stinger-overlay.is-leaving .eco-stinger-wave.wave-1 {
    transition: transform 0.55s cubic-bezier(0.77, 0, 0.175, 1) 0.2s;
    transform: translateX(101%);
}

.eco-stinger-overlay.is-leaving .eco-stinger-wave.wave-2 {
    transition: transform 0.55s cubic-bezier(0.77, 0, 0.175, 1) 0.1s;
    transform: translateX(101%);
}

.eco-stinger-overlay.is-leaving .eco-stinger-wave.wave-3 {
    transition: transform 0.55s cubic-bezier(0.77, 0, 0.175, 1) 0s;
    transform: translateX(101%);
}

.eco-stinger-overlay.is-leaving .eco-stinger-content {
    opacity: 0;
    transform: scale(1.1);
    transition: all 0.25s ease 0s;
}

