/* Reset and base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}
html {
    font-size: 16px;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-color);
    line-height: 1.7;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Theme variables */
:root {
    --primary-color: #2a9d8f;
    --secondary-color: #264653;
    --accent-color: #e9c46a;
    --background: #faf9f7;
    --text-color: #111;
    --border: #ddd;
    --header-gradient: linear-gradient(to bottom, var(--secondary-color), var(--primary-color));
    --dark-background: #121212;
    --dark-text-color: #f1f1f1;
    --light-gray: #f5f5f7;
    --transition-speed: 0.3s;
    --shadow: 0 2px 8px rgba(0,0,0,0.05);
    --dark-shadow: 0 4px 16px rgba(255,255,255,0.05);
    --dark-border: #444;
    --breakpoint-xs: 480px;
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
}

body.dark-theme {
    background: var(--dark-background);
    color: var(--dark-text-color);
}

/* Welcome modal */
.welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.welcome-content {
    background: #fff;
    padding: clamp(1rem, 3vw, 2rem);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    max-width: min(800px, 90vw);
    width: 90%;
    text-align: left;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Welcome modal dark-mode tweaks */
body.dark-theme .welcome-content {
    background: var(--dark-background);
    border: 1px solid var(--dark-border);
}
body.dark-theme .welcome-content h2,
body.dark-theme .welcome-content h3,
body.dark-theme .welcome-content p,
body.dark-theme .welcome-content li,
body.dark-theme .welcome-content a {
    color: var(--dark-text-color);
}
body.dark-theme #welcome-close {
    background: var(--secondary-color);
    color: #fff;
}
body.dark-theme #welcome-close:hover {
    background: var(--accent-color);
}

/* Header & navigation */
.header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--header-gradient) !important;
    color: #fff;
    padding: clamp(1rem, 3vw, 2rem) clamp(0.5rem, 2vw, 1rem);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: fadeInDown 0.5s ease-out both;
    width: 100%;
    position: relative;
    z-index: 10;
}

#dashboard-logo img {
    height: auto;
    width: clamp(200px, 30vw, 600px);
    max-width: 100%;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-container h2 {
    font-size: clamp(1.3rem, 4vw, 2.5rem);
    color: #fff;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    line-height: 1.2;
}

/* Address & datetime */
#address-container {
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    color: rgba(255,255,255,0.85);
    margin-bottom: 0.75rem;
}
#datetime-container {
    display: inline-flex;
    gap: clamp(0.5rem, 2vw, 1rem);
    background: rgba(255,255,255,0.15);
    padding: clamp(0.4rem, 1vw, 0.5rem) clamp(0.75rem, 2vw, 1rem);
    border-radius: 999px;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.2);
    margin-bottom: 1rem;
}
#datetime-container span {
    font-weight: 500;
    color: #fff;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-family: monospace;
}

/* Logo row */
.logo-container {
    display: flex;
    justify-content: center;
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-top: 1rem;
    flex-wrap: wrap;
}
.logo-box {
    width: clamp(60px, 15vw, 80px);
    aspect-ratio: 1/1;
    background: #fff;
    border-radius: 12px;
    padding: clamp(0.3rem, 1vw, 0.5rem);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform var(--transition-speed);
}
.logo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition-speed);
}
.logo-box:hover img {
    transform: scale(1.1);
}

/* Tabs */
.tab-container {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(100px, 1fr);
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem; /* Increased padding for indicator */
    background: var(--header-gradient);
    position: relative; /* Add this */
    min-height: 60px; /* Ensure minimum height */
}
.tab-container .tab-button {
    padding: clamp(0.75rem, 2vw, 1rem);
    border: none;
    color: #fff;
    font-size: clamp(0.9rem, 2vw, 1rem);
    cursor: pointer;
    background: var(--header-gradient) !important;
    background-size: 200% auto;
    transition: filter var(--transition-speed);
    position: relative;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%; /* Take full height of container */
    min-height: 50px; /* Minimum height for tabs */
}
.tab-container .tab-button:hover {
    filter: brightness(1.2);
}
.tab-container .tab-button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.tab-container .tab-button.active {
    position: relative;
}
.tab-container .tab-button.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0; /* Always at the bottom */
    height: 4px;
    background-color: #FF9800;
    z-index: 1;
    border-radius: 2px 2px 0 0;
    animation: slideIn 0.3s ease-out;
}
.tab-container .tab-button:not(.active):hover::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background-color: rgba(255, 152, 0, 0.5);
    z-index: 1;
    border-radius: 2px 2px 0 0;
}
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
/* Hamburger */
.hamburger {
    font-size: clamp(20px, 5vw, 26px);
    background: var(--header-gradient) !important;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: clamp(8px, 2vw, 12px);
    position: static;
    order: 0;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: min(250px, 80vw);
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: #004c59;
    color: white;
    transition: 0.3s ease;
    z-index: 1000;
    padding: clamp(15px, 4vw, 20px);
}
.sidebar.open {
    left: 0;
}

.sidebar .nav-tabs {
    margin-bottom: clamp(1rem, 3vw, 2rem);
}

.sidebar .nav-tabs ul {
    list-style: none;
}

.sidebar .nav-tabs li {
    margin-bottom: 0.5rem;
}

.sidebar .nav-tabs a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 10px 0;
    border-bottom: 1px solid #ffffff33;
    font-size: clamp(0.9rem, 2vw, 1rem);
}
.sidebar .nav-tabs a:hover {
    background-color: #006c80;
    padding-left: 10px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 999;
}
.sidebar.open + .overlay {
    display: block;
}

/* Main sections */
.sensor-section {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: clamp(1rem, 3vw, 2rem);
    margin: clamp(1rem, 3vw, 2rem) auto;
    max-width: min(1200px, 95vw);
    width: 100%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.sensor-section h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    color: var(--secondary-color);
    background: var(--header-gradient);
    -webkit-background-clip: text; 
    background-clip: text;         
    -webkit-text-fill-color: transparent; 
    color: transparent;                  
    margin-bottom: 1.5rem;
}

.sensor-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
}

body.dark-theme .sensor-section {
    background: #1e1e1e;
    border-color: var(--dark-border);
    box-shadow: var(--dark-shadow);
}

/* Section titles */
.section-title {
    text-align: center;
    font-size: clamp(1.5rem, 4vw, 1.75rem);
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Buttons */
button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.button {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    padding: clamp(0.6rem, 2vw, 0.75rem);
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}
.button:hover {
    background: var(--accent-color);
}

/* Switch (toggle) */
.switch-wrapper {
    margin-top: clamp(1rem, 3vw, 2rem);
}

.switch {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.switch-label {
    margin-right: 0.5rem;
    font-weight: 500;
    color: #fff;
}
.switch input {
    display: none;
}
.slider {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #ccc;
    border-radius: 13px;
    transition: background-color 0.2s ease;
}
.slider::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.switch input:checked + .slider {
    background-color: #1abc9c;
}
.switch input:checked + .slider::before {
    transform: translateX(24px);
}
.switch:hover .slider {
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.1);
}
body.dark-theme .switch-label {
    color: #eee;
}

/* Dashboard Controls */
.dashboard-controls {
    margin: clamp(1rem, 3vw, 2rem) auto;
    max-width: min(600px, 95vw);
    width: 100%;
}

.dashboard-selector {
    background: rgba(255, 255, 255, 0.05);
    padding: clamp(1rem, 3vw, 1.5rem);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.custom-dropdown {
    position: relative;
    max-width: 400px;
    margin: 1rem auto 0;
    width: 100%;
}

.dashboard-dropdown {
    width: 100%;
    padding: clamp(0.75rem, 2vw, 0.875rem) clamp(0.9rem, 2vw, 1rem);
    font-size: clamp(0.70rem, 2vw, 1rem);
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    color: #374151;
    appearance: none;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    transition: border-color 0.3s ease;
}

.dashboard-dropdown:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dropdown-arrow {
    position: absolute;
    right: clamp(0.9rem, 2vw, 1rem);
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6b7280;
}

.selector-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #374151;
    font-size: clamp(1rem, 2vw, 1.1rem);
}

/* Dark mode dropdown */
body.dark-theme .dashboard-dropdown {
    background: #374151;
    border-color: #4b5563;
    color: var(--primary-color);
}

body.dark-theme .selector-label {
    color: #d1d5db;
}

body.dark-theme .dropdown-arrow {
    color: #9ca3af;
}

/* ========== ENHANCED INFORMATION SECTION STYLES ========== */

/* Info Header */
.info-header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    position: relative;
}

.info-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: min(100px, 20vw);
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

.info-icon {
    width: clamp(60px, 15vw, 80px);
    height: clamp(60px, 15vw, 80px);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 20px rgba(42, 157, 143, 0.3);
    animation: float 3s ease-in-out infinite;
}

.info-icon i {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: white;
}

.info-header h3 {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.info-subtitle {
    color: #666;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 500;
    letter-spacing: 1px;
}


/* Features Grid */

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: 2.5rem;
}

.feature-card {
    background: white;
    padding: clamp(1rem, 3vw, 1.5rem);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

body.dark-theme .feature-card {
    background: #2c2c2c;
    border-color: var(--dark-border);
    box-shadow: var(--dark-shadow);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(42, 157, 143, 0.15);
    border-color: var(--primary-color);
}

.feature-icon {
    width: clamp(50px, 12vw, 60px);
    height: clamp(50px, 12vw, 60px);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--primary-color);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

body.dark-theme .feature-icon {
    background: var(--primary-color);
}

.feature-card h4 {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
}

.feature-card p {
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    color: #666;
    line-height: 1.5;
}

/* Description Card */
.description-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    padding: clamp(1.5rem, 4vw, 2rem);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-top: 2rem;
}

body.dark-theme .description-card {
    background: linear-gradient(135deg, #2c2c2c 0%, #1e1e1e 100%);
    border-color: var(--dark-border);
}

.description-header {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 0.75rem);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.description-header i {
    color: var(--primary-color);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

.description-header h4 {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    color: var(--secondary-color);
}

.description-text {
    font-size: clamp(0.95rem, 2vw, 1rem);
    line-height: 1.7;
    color: #555;
    text-align: justify;
    margin-bottom: 2rem;
}

/* Team Section */
.team-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px dashed #ddd;
}

body.dark-theme .team-section {
    border-top-color: #444;
}

.team-section h5 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.team-section h5 i {
    color: var(--primary-color);
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.team-member {
    display: flex;
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    gap: clamp(0.75rem, 2vw, 1rem);
    padding: clamp(0.75rem, 2vw, 1rem);
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: center; 
    min-height: 140px; 
}

.team-member:hover {
    background: rgba(42, 157, 143, 0.1);
    transform: translateY(-5px); 
}

.member-avatar {
    width: clamp(40px, 10vw, 50px);
    height: clamp(40px, 10vw, 50px);
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    margin: 0 auto; /* Center the avatar */
}

.team-member:hover .member-avatar {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.member-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    width: 100%; 
}

.member-name {
    display: block;
    font-size: clamp(0.75rem, 2vw, 0.8rem);
    color: #444;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-align: center; 
    width: 100%; 
}

.member-email {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the email horizontally */
    gap: 0.5rem;
    font-size: clamp(0.55rem, 1.5vw, 0.6rem);
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%; 
    width: fit-content; 
    margin: 0 auto;
    padding: 0.25rem 0.5rem; 
    border-radius: 4px; 
}

.member-email:hover {
    color: var(--secondary-color);
    text-decoration: underline;
    background: rgba(42, 157, 143, 0.1); /* Add subtle background on hover */
}

.member-email i {
    font-size: clamp(0.6rem, 1.5vw, 0.7rem);
    opacity: 0.8;
    flex-shrink: 0; /* Prevent icon from shrinking */
}


.team-affiliation {
    text-align: center;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: rgba(42, 157, 143, 0.05);
    border-radius: 8px;
    margin-top: 1.5rem;
    border-left: 4px solid var(--primary-color);
}

.team-affiliation i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.affiliation-detail {
    display: block;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: #666;
    margin-top: 0.5rem;
}

/* ========== TRINODE IMAGE SECTION STYLES ========== */

.trinode-image-section {
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 4vw, 2rem);
    margin: clamp(1.5rem, 4vw, 2.5rem) 0;
    padding: clamp(1.5rem, 4vw, 2rem);
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.image-container {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
body.dark-theme .image-container {
    background: #fff;
}

.trinode-main-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 100vh;
    max-width: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.trinode-main-image:hover {
    transform: scale(1.02);
}

.image-caption {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: clamp(1rem, 2vw, 1rem);
    background: rgba(42, 157, 143, 0.9);
    color: white;
    font-size: clamp(0.5rem, 2vw, 0.9rem);
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
}

.image-caption i {
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.image-description {
    padding: 0 clamp(0.75rem, 2vw, 1rem);
}

.image-description h4 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    color: var(--secondary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

.image-description h4 i {
    color: var(--primary-color);
}

.image-description p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.node-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: clamp(0.75rem, 2vw, 1rem);
    margin-top: 1.5rem;
}

.node-detail {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1rem);
    padding: clamp(0.75rem, 2vw, 1rem);
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.node-detail:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background: rgba(42, 157, 143, 0.05);
}

.node-marker {
    width: clamp(35px, 10vw, 40px);
    height: clamp(35px, 10vw, 40px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    flex-shrink: 0;
}

.node-1 {
    background: linear-gradient(135deg, #e76f51, #e63946);
}
.node-2 {
    background: linear-gradient(135deg, #2a9d8f, #264653);
}
.node-3 {
    background: linear-gradient(135deg, #e9c46a, #f4a261);
}

.node-info {
    display: flex;
    flex-direction: column;
}

.node-info strong {
    color: var(--primary-color);
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    margin-bottom: 0.25rem;
}

.node-info span {
    color: #666;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    line-height: 1.4;
}

/* ========== ENHANCED ADMIN SECTION STYLES ========== */
/* Admin Login Section */
.admin-login-section {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%) !important;
    color: white;
    border: none !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.admin-login-container {
    max-width: min(400px, 95vw);
    width: 100%;
    padding: clamp(1.5rem, 4vw, 2rem);
    margin: 0 auto;
}

.admin-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.admin-icon {
    width: clamp(60px, 15vw, 80px);
    height: clamp(60px, 15vw, 80px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.admin-icon i {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: white;
}

.admin-login-section h2 {
    color: white !important;
    background: none !important;
    -webkit-text-fill-color: white !important;
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 0.5rem;
}

.admin-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    font-weight: 400;
}

.admin-login-form {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: clamp(1.5rem, 4vw, 2rem);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: clamp(0.9rem, 2vw, 0.95rem);
}

.form-label i {
    font-size: 0.9rem;
    opacity: 0.8;
}

.admin-login-form input {
    width: 100%;
    padding: clamp(0.75rem, 2vw, 0.875rem) clamp(0.9rem, 2vw, 1rem);
    padding-right: 3rem !important;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-size: clamp(0.95rem, 2vw, 1rem);
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.admin-login-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.admin-login-form input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.password-toggle {
    position: absolute;
    right: clamp(0.9rem, 2vw, 1rem);
    top: 70%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: clamp(1rem, 2vw, 1.1rem);
    padding: 0.5rem;
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0.8;
    height: 100%;
    display: flex;
    align-items: center;
}

.password-toggle:hover {
    color: white;
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.form-actions {
    margin-top: 2rem;
}

.admin-login-btn {
    width: 100%;
    padding: clamp(0.875rem, 2vw, 1rem);
    background: linear-gradient(135deg, #e9c46a 0%, #f4a261 100%);
    color: var(--secondary-color);
    border: none;
    border-radius: 10px;
    font-size: clamp(0.95rem, 2vw, 1rem);
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.admin-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 196, 106, 0.4);
}

.admin-login-btn:active {
    transform: translateY(0);
}

.admin-note {
    margin-top: 1.5rem;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid #e9c46a;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: clamp(0.8rem, 2vw, 0.85rem);
    color: rgba(255, 255, 255, 0.9);
}

.admin-note i {
    color: #e9c46a;
    font-size: 1rem;
    margin-top: 0.1rem;
}

/* Admin Panel Section */
.admin-panel-section {
    background: var(--background) !important;
    max-width: min(1200px, 95vw);
    margin: clamp(1rem, 3vw, 2rem) auto !important;
    width: 100%;
    padding: clamp(1rem, 3vw, 2rem);
    box-sizing: border-box;
}

.admin-panel-card {
    background: white;
    border-radius: 20px;
    padding: clamp(2rem, 5vw, 3rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}

.admin-panel-header {
    text-align: center;
    margin-bottom: clamp(2rem, 5vw, 3rem);
    padding-bottom: clamp(1.5rem, 4vw, 2rem);
    border-bottom: 2px solid var(--light-gray);
}

.admin-panel-icon {
    width: clamp(80px, 20vw, 100px);
    height: clamp(80px, 20vw, 100px);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 30px rgba(42, 157, 143, 0.3);
    animation: float 3s ease-in-out infinite;
}

.admin-panel-icon i {
    font-size: clamp(2rem, 5vw, 3rem);
    color: white;
}

.admin-panel-card h2 {
    color: var(--secondary-color) !important;
    background: none !important;
    -webkit-text-fill-color: var(--secondary-color) !important;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 0.5rem;
}

.admin-panel-subtitle {
    color: #666;
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 500;
    letter-spacing: 1px;
}

.admin-sections {
    display: flex;
    flex-direction: column;
    gap: clamp(2rem, 5vw, 3rem);
}

.admin-section {
    background: #f8f9fa;
    border-radius: 16px;
    padding: clamp(1.5rem, 4vw, 2rem);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.admin-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.section-header {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1rem);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.section-header i {
    color: var(--primary-color);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

.section-header h3 {
    color: var(--secondary-color);
    font-size: clamp(1.2rem, 3vw, 1.4rem);
    font-weight: 600;
    flex: 1;
    margin: 0;
}

.reset-btn {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #ddd;
    padding: clamp(0.4rem, 1vw, 0.5rem) clamp(0.8rem, 2vw, 1rem);
    border-radius: 8px;
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: var(--secondary-color);
}

/* Siren Control Styles */
.siren-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: clamp(0.75rem, 2vw, 1rem);
}

.radio-option {
    position: relative;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option label {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1rem);
    padding: clamp(1rem, 3vw, 1.5rem);
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.radio-option input[type="radio"]:checked + label {
    border-color: var(--primary-color);
    background: rgba(42, 157, 143, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(42, 157, 143, 0.15);
}

.radio-option label:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.radio-icon {
    width: clamp(50px, 12vw, 60px);
    height: clamp(50px, 12vw, 60px);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    transition: all 0.3s ease;
}

.radio-option input[type="radio"]:checked + label .radio-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.radio-label {
    flex: 1;
}

.radio-label strong {
    display: block;
    color: var(--secondary-color);
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    margin-bottom: 0.25rem;
}

.radio-label span {
    color: #666;
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    line-height: 1.4;
}

/* Threshold Controls Grid */
.threshold-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: clamp(1.5rem, 4vw, 2rem);
    width: 100%;
}

.threshold-control {
    background: white;
    padding: clamp(1.25rem, 3vw, 1.5rem);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.threshold-control:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

.threshold-header {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 0.75rem);
    margin-bottom: 1rem;
}

.threshold-header i {
    color: var(--primary-color);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

.threshold-header label {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: clamp(0.95rem, 2.5vw, 1rem);
    flex: 1;
}

.threshold-unit {
    background: #f8f9fa;
    color: #666;
    padding: clamp(0.2rem, 0.5vw, 0.25rem) clamp(0.5rem, 1vw, 0.75rem);
    border-radius: 20px;
    font-size: clamp(0.75rem, 2vw, 0.8rem);
    font-weight: 500;
    white-space: nowrap;
}

.threshold-control input[type="range"] {
    width: 100%;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: linear-gradient(to right, #e9ecef, var(--primary-color));
    border-radius: 3px;
    outline: none;
    margin: 1rem 0;
}

.threshold-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: clamp(20px, 5vw, 24px);
    height: clamp(20px, 5vw, 24px);
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.threshold-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.threshold-control input[type="range"]::-moz-range-thumb {
    width: clamp(20px, 5vw, 24px);
    height: clamp(20px, 5vw, 24px);
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.threshold-control input[type="range"]::-moz-range-track {
    background: linear-gradient(to right, #e9ecef, var(--primary-color));
    height: 6px;
    border-radius: 3px;
    border: none;
}

.threshold-value-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
}

#geo-threshold-display,
#rain-threshold-display,
#moisture-threshold-display,
#battery-threshold-display,
#accel-mag-threshold-display,
#geo-accel-threshold-display,
#gyro-mag-threshold-display {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    color: var(--secondary-color);
    font-family: 'Poppins', monospace;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.threshold-range {
    color: #666;
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    font-weight: 500;
}

/* Admin Footer */
.admin-footer {
    margin-top: clamp(2rem, 5vw, 3rem);
    padding-top: clamp(1.5rem, 4vw, 2rem);
    border-top: 2px solid var(--light-gray);
    text-align: center;
    display: flex;
    justify-content: center;
}

.logout-form {
    width: 100%;
    max-width: min(300px, 95vw);
}

.logout-btn {
    width: 100%;
    padding: clamp(0.875rem, 2vw, 1rem) clamp(1.5rem, 3vw, 2rem);
    background: linear-gradient(135deg, #e76f51, #e63946);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: clamp(0.95rem, 2vw, 1rem);
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 111, 81, 0.4);
}

.logout-btn:active {
    transform: translateY(0);
}

/* ========== ENHANCED TELEGRAM SECTION STYLES ========== */

#telegram-section .telegram-header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    position: relative;
}

#telegram-section .telegram-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: min(100px, 20vw);
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

#telegram-section .telegram-icon {
    width: clamp(60px, 15vw, 80px);
    height: clamp(60px, 15vw, 80px);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 20px rgba(42, 157, 143, 0.3);
    animation: float 3s ease-in-out infinite;
}

#telegram-section .telegram-icon i {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: white;
}

#telegram-section .section-title {
    font-size: clamp(1.3rem, 4vw, 2.5rem);
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

#telegram-section .telegram-subtitle {
    color: #666;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 500;
    letter-spacing: 1px;
    max-width: min(600px, 95vw);
    margin: 0 auto;
}

/* Telegram Content */
#telegram-section .telegram-content {
    max-width: min(1000px, 95vw);
    margin: 0 auto;
    width: 100%;
}

#telegram-section .telegram-card {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: clamp(1.25rem, 3vw, 2.5rem);
    border-radius: clamp(0.875rem, 2vw, 1.25rem);
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    width: 100%;
}

#telegram-section .telegram-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0, 119, 204, 0.15);
}

/* QR Container */
#telegram-section .qr-container {
    position: relative;
    flex: 1;
    min-width: min(200px, 80vw);
    max-width: min(300px, 90vw);
    text-align: center;
    margin: 0 auto;
}

#telegram-section .telegram-qr {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: 3px solid white;
    object-fit: cover;
}

#telegram-section .telegram-qr:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 35px rgba(0, 119, 204, 0.25);
}

#telegram-section .qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(42, 157, 143, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    font-weight: 500;
    padding: 1rem;
}

#telegram-section .qr-container:hover .qr-overlay {
    opacity: 1;
}

#telegram-section .qr-overlay i {
    font-size: clamp(1.25rem, 3vw, 2rem);
    margin-bottom: 0.5rem;
}

#telegram-section .qr-overlay span {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    text-align: center;
}

/* Telegram Info */
#telegram-section .telegram-info {
    flex: 2;
    min-width: min(250px, 90vw);
    width: 100%;
}

#telegram-section .handle-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: 1.5rem;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: rgba(0, 119, 204, 0.05);
    border-radius: 12px;
    border-left: 4px solid #0088cc;
}

#telegram-section .handle-container i {
    color: #0088cc;
    font-size: clamp(1.25rem, 3vw, 2rem);
}

#telegram-section .telegram-handle {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0;
    word-break: break-all;
    overflow-wrap: break-word;
}

#telegram-section .telegram-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
    font-size: clamp(0.85rem, 2vw, 1rem);
    text-align: center;
}

/* Telegram Features */
#telegram-section .telegram-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
}

#telegram-section .telegram-features .feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    min-height: clamp(90px, 20vw, 100px);
}

#telegram-section .telegram-features .feature:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 119, 204, 0.1);
    border-color: #0088cc;
}

#telegram-section .telegram-features .feature i {
    color: #0088cc;
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

#telegram-section .telegram-features .feature span {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    color: #555;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
}

/* Telegram Button */
#telegram-section .telegram-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: clamp(0.75rem, 2vw, 1rem) clamp(1rem, 3vw, 2rem);
    background: linear-gradient(135deg, #0088cc 0%, #006b99 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 119, 204, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#telegram-section .telegram-btn:hover {
    background: linear-gradient(135deg, #006b99 0%, #00557a 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 119, 204, 0.4);
}

#telegram-section .telegram-btn i {
    font-size: clamp(0.95rem, 2vw, 1.2rem);
}

/* Telegram Note */
#telegram-section .telegram-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #666;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    text-align: center;
    margin: 0;
    padding: 0.75rem;
    background: rgba(0, 119, 204, 0.05);
    border-radius: 8px;
    flex-wrap: wrap;
}

#telegram-section .telegram-note i {
    color: #0088cc;
    font-size: 0.9rem;
}

/* ========== QR CODE ZOOM MODAL ========== */

.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1rem;
}

.qr-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.qr-modal-content {
    position: relative;
    z-index: 2;
    background: white;
    border-radius: 20px;
    max-width: min(500px, 95vw);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease-out;
    display: flex;
    flex-direction: column;
}

.qr-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(1.25rem, 3vw, 1.5rem);
    border-bottom: 1px solid #e2e8f0;
}

.qr-modal-header h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    color: var(--secondary-color);
    margin: 0;
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.qr-modal-close {
    background: #f8f9fa;
    border: none;
    width: clamp(35px, 10vw, 40px);
    height: clamp(35px, 10vw, 40px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    font-size: clamp(1.1rem, 3vw, 1.2rem);
}

.qr-modal-close:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

.qr-modal-body {
    padding: clamp(1.5rem, 4vw, 2rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1.5rem, 4vw, 2rem);
}

.zoomed-qr-image {
    width: clamp(200px, 60vw, 280px);
    height: clamp(200px, 60vw, 280px);
    border-radius: 12px;
    border: 3px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.zoomed-qr-image:hover {
    transform: scale(1.02);
}

.qr-instructions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(1rem, 3vw, 1.5rem);
    width: 100%;
}

.qr-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: min(120px, 100%);
    text-align: center;
}

.qr-step i {
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--primary-color);
    width: clamp(45px, 12vw, 60px);
    height: clamp(45px, 12vw, 60px);
    background: rgba(42, 157, 143, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.qr-step:hover i {
    background: var(--primary-color);
    color: white;
    transform: translateY(-5px);
}

.qr-step span {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: #555;
    font-weight: 500;
    line-height: 1.4;
}

.qr-modal-footer {
    padding: clamp(1.25rem, 3vw, 1.5rem);
    border-top: 1px solid #e2e8f0;
    text-align: center;
    background: rgba(0, 119, 204, 0.05);
    border-radius: 0 0 20px 20px;
}

.qr-handle-large {
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    word-break: break-all;
}

.qr-direct-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1.25rem, 3vw, 1.5rem);
    background: linear-gradient(135deg, #0088cc 0%, #006b99 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

.qr-direct-link:hover {
    background: linear-gradient(135deg, #006b99 0%, #00557a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 204, 0.3);
}

.qr-direct-link i {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Make QR clickable in telegram section */
#telegram-section .qr-container {
    cursor: pointer;
}

#telegram-section .qr-container::before {
    content: 'Click to zoom';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: clamp(0.7rem, 2vw, 0.75rem);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

#telegram-section .qr-container::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#telegram-section .qr-container:hover::before,
#telegram-section .qr-container:hover::after {
    opacity: 1;
}

#telegram-section .qr-container:hover::before {
    transform: translateX(-50%) translateY(-5px);
}

/* ========== DARK THEME FIXES ========== */

/* Dark Theme Login */
body.dark-theme .admin-login-form input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: white;
}

body.dark-theme .admin-login-form input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
}

body.dark-theme .password-toggle {
    color: rgba(255, 255, 255, 0.9);
}

body.dark-theme .password-toggle:hover {
    color: white;
}

/* Dark Theme Panel */
body.dark-theme .admin-panel-section {
    background: var(--dark-background) !important;
}

body.dark-theme .admin-panel-card {
    background: #2c2c2c;
    border-color: var(--dark-border);
    box-shadow: var(--dark-shadow);
}

body.dark-theme .admin-section {
    background: #1e1e1e;
    border-color: var(--dark-border);
}

body.dark-theme .section-header {
    border-bottom-color: var(--dark-border);
}

body.dark-theme .reset-btn {
    background: #2c2c2c;
    color: #bbb;
    border-color: #444;
}

body.dark-theme .reset-btn:hover {
    background: #3c3c3c;
    border-color: #666;
    color: var(--dark-text-color);
}

body.dark-theme .radio-option label {
    background: #2c2c2c;
    border-color: #444;
    color: var(--dark-text-color);
}

body.dark-theme .radio-icon {
    background: #3c3c3c;
    color: var(--primary-color);
}

body.dark-theme .radio-option input[type="radio"]:checked + label .radio-icon {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

body.dark-theme .radio-label strong {
    color: var(--dark-text-color);
}

body.dark-theme .radio-label span {
    color: #aaa;
}

body.dark-theme .threshold-control {
    background: #2c2c2c;
    border-color: #444;
}

body.dark-theme .threshold-header label {
    color: var(--dark-text-color) !important;
}

body.dark-theme .threshold-unit {
    background: #444;
    color: #ddd !important;
    border: 1px solid #555;
}

body.dark-theme .threshold-control input[type="range"] {
    background: linear-gradient(to right, #555, var(--primary-color));
}

body.dark-theme .threshold-control input[type="range"]::-webkit-slider-thumb {
    background: var(--primary-color);
    border: 3px solid #2c2c2c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

body.dark-theme .threshold-control input[type="range"]::-moz-range-thumb {
    background: var(--primary-color);
    border: 3px solid #2c2c2c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Dark mode threshold values */
body.dark-theme #geo-threshold-display,
body.dark-theme #rain-threshold-display,
body.dark-theme #moisture-threshold-display,
body.dark-theme #battery-threshold-display,
body.dark-theme #accel-mag-threshold-display,
body.dark-theme #geo-accel-threshold-display,
body.dark-theme #gyro-mag-threshold-display {
    color: var(--primary-color) !important;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(42, 157, 143, 0.4);
}

body.dark-theme .threshold-range {
    color: #bbb !important;
    font-weight: 500;
}

body.dark-theme .threshold-value-display {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .admin-footer {
    border-top-color: #444;
}

/* ========== THRESHOLD INSTRUCTIONS SECTION ========== */

#threshold-instructions-section {
    background: var(--background) !important;
    max-width: min(1200px, 95vw);
    margin: clamp(1rem, 3vw, 2rem) auto !important;
    width: 100%;
    padding: clamp(1rem, 3vw, 2rem);
    box-sizing: border-box;
}

.threshold-instructions-container {
    background: white;
    border-radius: 20px;
    padding: clamp(2rem, 5vw, 3rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}

.threshold-header {
    text-align: center;
    margin-bottom: clamp(2rem, 5vw, 3rem);
    padding-bottom: clamp(1.5rem, 4vw, 2rem);
    border-bottom: 2px solid var(--light-gray);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.threshold-icon {
    width: clamp(80px, 20vw, 100px);
    height: clamp(80px, 20vw, 100px);
    background: linear-gradient(135deg, #e9c46a, #f4a261);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 30px rgba(233, 196, 106, 0.3);
    animation: float 3s ease-in-out infinite;
}

.threshold-icon i {
    font-size: clamp(2rem, 5vw, 3rem);
    color: white;
}

.threshold-subtitle {
    color: #666;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 500;
    letter-spacing: 1px;
    max-width: min(600px, 95vw);
    margin: 0 auto;
    text-align: center;
    display: block;
    width: 100%;
}

/* Threshold Legend */
.threshold-legend {
    display: flex;
    justify-content: center;
    gap: clamp(1rem, 3vw, 2rem);
    margin-bottom: clamp(2rem, 5vw, 3rem);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: #f8f9fa;
    border-radius: 12px;
    min-width: min(120px, 100%);
    transition: transform 0.3s ease;
    flex: 1;
    max-width: 150px;
}

.legend-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.legend-color {
    width: clamp(25px, 6vw, 40px);
    height: clamp(25px, 6vw, 40px);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.legend-color.normal {
    background: linear-gradient(135deg, #2a9d8f, #264653);
}

.legend-color.warning {
    background: linear-gradient(135deg, #e9c46a, #f4a261);
}

.legend-color.dangerous {
    background: linear-gradient(135deg, #e76f51, #e63946);
}

.legend-label {
    font-weight: 600;
    font-size: clamp(0.85rem, 2vw, 1.1rem);
    color: var(--secondary-color);
    text-align: center;
}

.legend-desc {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #666;
    text-align: center;
    line-height: 1.3;
}

/* Threshold Table */
.threshold-table-container {
    margin-bottom: clamp(2rem, 5vw, 3rem);
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    min-width: min(100%, 800px);
    margin: 0 auto;
}

.threshold-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 800px;
}

.threshold-table th {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    letter-spacing: 0.5px;
    padding: clamp(0.75rem, 2vw, 1rem);
    position: sticky;
    top: 0;
    white-space: nowrap;
}

.threshold-table th.sensor-column {
    width: 30%;
    border-radius: 12px 0 0 0;
    min-width: 200px;
}

.threshold-table th.level-column {
    width: 20%;
    min-width: 150px;
}

.threshold-table th.unit-column {
    width: 10%;
    border-radius: 0 12px 0 0;
    min-width: 80px;
}

.threshold-table tbody tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.threshold-table tbody tr:hover {
    background: rgba(42, 157, 143, 0.05);
    transform: scale(1.005);
}

.threshold-table td {
    padding: clamp(0.75rem, 2vw, 1rem);
    vertical-align: middle;
}

/* Sensor Info Cell */
.sensor-info {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1rem);
    min-width: 200px;
}

.sensor-icon {
    width: clamp(35px, 8vw, 50px);
    height: clamp(35px, 8vw, 50px);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: clamp(1rem, 3vw, 1.5rem);
    flex-shrink: 0;
}
body.dark-theme .sensor-icon {
    background: var(--primary-color);
}
.sensor-details {
    flex: 1;
    min-width: 0;
}

.sensor-details strong {
    display: block;
    color: var(--secondary-color);
    font-size: clamp(0.85rem, 2vw, 1.1rem);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.sensor-desc {
    display: block;
    color: #666;
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Level Cells */
.level-cell {
    text-align: center;
    font-weight: 600;
    border-radius: 8px;
    padding: clamp(0.5rem, 1.5vw, 0.75rem);
    min-width: 150px;
}

.normal-level {
    background: rgba(42, 157, 143, 0.1);
    color: var(--secondary-color);
    border: 2px solid rgba(42, 157, 143, 0.3);
}

.warning-level {
    background: rgba(233, 196, 106, 0.1);
    color: #b87d00;
    border: 2px solid rgba(233, 196, 106, 0.3);
}

.dangerous-level {
    background: rgba(231, 111, 81, 0.1);
    color: #c53030;
    border: 2px solid rgba(231, 111, 81, 0.3);
}

.level-value {
    font-size: clamp(0.8rem, 2vw, 1rem);
    font-weight: 700;
    margin-bottom: 0.25rem;
    font-family: 'Poppins', monospace;
    word-break: break-word;
}

.level-status {
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    line-height: 1.3;
}

.unit-cell {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(42, 157, 143, 0.05);
    border-radius: 8px;
    min-width: 80px;
    font-size: clamp(0.8rem, 2vw, 1rem);
}

/* Additional Information */
.threshold-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: clamp(1.5rem, 4vw, 2rem);
    margin-top: clamp(2rem, 5vw, 3rem);
}

.info-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: clamp(1.25rem, 3vw, 2rem);
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.info-icon {
    width: clamp(45px, 10vw, 60px);
    height: clamp(45px, 10vw, 60px);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.info-icon i {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    color: white;
}

.info-content h4 {
    color: var(--secondary-color);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.info-content p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: clamp(0.85rem, 2vw, 1rem);
}

.info-content ul {
    list-style: none;
    padding-left: 0;
    margin-top: 1rem;
}

.info-content li {
    padding: 0.5rem 0;
    border-bottom: 1px dashed #ddd;
    color: #666;
    display: flex;
    align-items: flex-start;
    font-size: clamp(0.85rem, 2vw, 1rem);
    line-height: 1.5;
}

.info-content li:last-child {
    border-bottom: none;
}

.info-content li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 0.5rem;
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* Score Info */
.score-info {
    display: flex;
    gap: clamp(1rem, 3vw, 2rem);
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.score-item {
    flex: 1;
    min-width: min(120px, 100%);
    text-align: center;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: white;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.score-label {
    display: block;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    color: #666;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.score-value {
    display: block;
    font-size: clamp(0.95rem, 2.5vw, 1.25rem);
    font-weight: 700;
    color: var(--secondary-color);
    font-family: 'Poppins', monospace;
}

/* ========== DASHBOARD TAB STYLES ========== */

/* Dashboard section layout */
#dashboard-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: none;
    padding: clamp(1rem, 3vw, 2rem) clamp(0.75rem, 2vw, 1.5rem);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    width: 100%;
    max-width: min(1400px, 95vw);
    margin: clamp(1rem, 3vw, 2rem) auto;
    position: relative;
    overflow: hidden;
}

#dashboard-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--secondary-color));
    border-radius: 20px 20px 0 0;
}

/* Dashboard controls enhancement */
.dashboard-controls {
    margin: clamp(1rem, 3vw, 1.5rem) auto clamp(1.5rem, 4vw, 2.5rem);
    max-width: min(600px, 95vw);
    width: 100%;
    padding: clamp(1rem, 3vw, 1.5rem);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(42, 157, 143, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}

/* Sensor Node Sections */
.sensor-node-section {
    background: white;
    border-radius: 16px;
    padding: clamp(1.5rem, 4vw, 2rem);
    margin-top: clamp(1.5rem, 4vw, 2rem);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    animation: fadeInUp 0.5s ease-out;
    position: relative;
    overflow: hidden;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.node-header h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.node-header h3 i {
    color: var(--primary-color);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.node-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: clamp(0.4rem, 1vw, 0.5rem) clamp(0.75rem, 2vw, 1rem);
    background: rgba(34, 197, 94, 0.1);
    border-radius: 20px;
    color: #16a34a;
    font-weight: 500;
    font-size: clamp(0.85rem, 2vw, 0.9rem);
}

/* Gauge Container Grid */
.gauge-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-top: 1.5rem;
}

/* Gauge Cards */
.gauge-card {
    background: white;
    border-radius: 16px;
    padding: clamp(1.25rem, 3vw, 1.5rem);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: clamp(250px, 60vw, 280px);
}

.gauge-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

/* Color classes for gauges and values */
.danger {
    color: #e74c3c !important;
}

.warning {
    color: #f39c12 !important;
}

.normal {
    color: #27ae60 !important;
}

/* For SVG circle gauges */
.gauge-fill.danger {
    stroke: #e74c3c !important;
}

.gauge-fill.warning {
    stroke: #f39c12 !important;
}

.gauge-fill.normal {
    stroke: #27ae60 !important;
}

/* For line gauge progress bars */
.gauge-progress.danger {
    background-color: #e74c3c !important;
    background-image: linear-gradient(to right, #e74c3c, #c0392b) !important;
}

.gauge-progress.warning {
    background-color: #f39c12 !important;
    background-image: linear-gradient(to right, #f39c12, #e67e22) !important;
}

.gauge-progress.normal {
    background-color: #27ae60 !important;
    background-image: linear-gradient(to right, #27ae60, #229954) !important;
}

/* For value display elements */
body.dark-theme .value-number.danger {
    color: #e74c3c !important;
    font-weight: bold;
}

body.dark-theme .value-number.warning {
    color: #f39c12 !important;
    font-weight: bold;
}

body.dark-theme .value-number.normal {
    color: #27ae60 !important;
}
/* ========== FIXED CIRCLE GAUGE STYLES ========== */
.circle-gauge-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem 0;
    position: relative;
    flex: 1; /* Take available space in card */
    min-height: 160px; /* Prevent layout shifting */
}

.circle-gauge {
    position: relative;
    width: clamp(120px, 30vw, 140px);
    height: clamp(120px, 30vw, 140px);
    margin: 0 auto;
}

.gauge-circle svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Rotate the entire SVG instead of individual circles */
    transform-origin: center;
}

.gauge-circle {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-background {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 12;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.gauge-value-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    text-align: center;
}

.gauge-value {
    font-size: clamp(1.1rem, 2.8vw, 1.2rem);
    font-weight: 700;
    color: var(--secondary-color);
    font-family: 'Poppins', sans-serif;
    line-height: 1;
    text-align: center;
    display: block;
    margin: 0;
    padding: 0;
}

/* ========== FIXED LINE GAUGE STYLES ========== */
.line-gauge-container {
    margin: clamp(1rem, 3vw, 1.5rem) 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gauge-track {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.gauge-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 6px;
    transition: width 1s ease;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: clamp(0.8rem, 2vw, 0.85rem);
    color: #64748b;
}

.gauge-value-display {
    font-weight: 600;
    color: var(--primary-color);
    font-size: clamp(0.85rem, 2vw, 0.95rem);
}

/* ========== FIXED VALUE CONTAINERS (GEOPHONE) ========== */
.value-container {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    position: relative; /* Add this */
}

.value-container:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.value-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.value-header h4 {
    font-size: clamp(0.875rem, 2vw, 1.1rem); 
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}
.gauge-header  {
    font-size: clamp(0.875rem, 2vw, 1.1rem); 
    font-weight: 600;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}
.value-display {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    margin: 1rem 0;
}

.value-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.value-number {
    font-size: clamp(2rem, 6vw, 2.5rem);
    font-weight: 700;
    color: var(--secondary-color);
    font-family: 'Poppins', sans-serif;
    line-height: 1;
    display: block;
    margin: 0;
}

.value-unit {
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    color: #64748b;
    font-weight: 500;
    margin-top: 0.5rem;
    display: block;
}

/* Gauge and Value Footers */
.gauge-footer,
.value-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.gauge-label {
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.25rem;
       font-size: clamp(0.6rem, 2vw, 0.85rem);
}

.status-text {
    font-weight: 600;
    padding: clamp(0.2rem, 0.5vw, 0.25rem) clamp(0.6rem, 1.5vw, 0.75rem);
    border-radius: 12px;
    font-size: clamp(0.75rem, 2vw, 0.8rem);
}

.status-text.normal {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.status-text.warning {
    background: rgba(234, 179, 8, 0.1);
    color: #ca8a04;
}

.status-text.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.update-time {
    font-weight: 500;
    color: var(--primary-color);
}

/* ========== ENHANCED CHART MODAL STYLES ========== */

.node-comparison-top.rain-sensor-hidden {
    display: none !important;
}
.chart-type-selector,
.time-range-selector {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}


/* Enhance chart menu button */
.chart-menu {
    background: rgba(42, 157, 143, 0.1);
    border: 1px solid rgba(42, 157, 143, 0.2);
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    position: absolute; 
    top: 1.5rem; 
    right: 1.5rem;
    z-index: 5; 
}
.chart-menu:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(42, 157, 143, 0.3);
}

.chart-menu:hover::after {
    content: 'View Chart';
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 100;
}

.chart-menu:hover::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--secondary-color);
}
.chart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: clamp(1rem, 3vw, 2rem);
}

.chart-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.4s ease;
}

.chart-modal-content {
    position: relative;
    z-index: 2;
    background: white;
    border-radius: 24px;
    max-width: min(1200px, 95vw);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: slideUpChart 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: auto;
}

.chart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(1.25rem, 3vw, 1.5rem) clamp(1.5rem, 4vw, 2rem);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 24px 24px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.chart-modal-header h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    color: white;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chart-modal-header h3::before {
    content: '📊';
    font-size: 1.2em;
}

.chart-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: clamp(40px, 10vw, 44px);
    height: clamp(40px, 10vw, 44px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    font-size: clamp(1.1rem, 3vw, 1.25rem);
}

.chart-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.chart-modal-body {
    padding: clamp(1.5rem, 4vw, 2rem);
    display: flex;
    flex-direction: column;
    gap: clamp(1.5rem, 4vw, 2rem);
}

.chart-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
    padding: clamp(1rem, 3vw, 1.5rem);
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.05), rgba(38, 70, 83, 0.05));
    border-radius: 16px;
    border: 1px solid rgba(42, 157, 143, 0.1);
}

.time-range-selector,
.chart-type-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.time-range-selector label,
.chart-type-selector label {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: clamp(0.9rem, 2vw, 0.95rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.time-range-selector label::before,
.chart-type-selector label::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.time-range-selector label::before {
    content: '⏰';
}

.chart-type-selector label::before {
    content: '📈';
}

.chart-controls label {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: clamp(0.9rem, 2vw, 0.95rem);
    white-space: nowrap;
}

.chart-controls select {
    padding: clamp(0.75rem, 2vw, 0.875rem) clamp(0.9rem, 2vw, 1rem);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #374151;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.9rem, 2vw, 0.95rem);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232a9d8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.chart-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

.chart-container {
    position: relative;
    height: clamp(350px, 60vh, 450px);
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: clamp(1.25rem, 3vw, 1.5rem);
    border: 2px solid rgba(42, 157, 143, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--secondary-color));
    border-radius: 20px 20px 0 0;
}

.chart-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
    gap: clamp(0.75rem, 2vw, 1rem);
    padding: clamp(1rem, 3vw, 1.5rem);
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.05), rgba(38, 70, 83, 0.05));
    border-radius: 16px;
    border: 1px solid rgba(42, 157, 143, 0.1);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: clamp(1rem, 3vw, 1.25rem);
    background: white;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.stat-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(42, 157, 143, 0.15);
    border-color: rgba(42, 157, 143, 0.2);
}

.stat-label {
    font-size: clamp(0.8rem, 2vw, 0.85rem);
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 12px 12px 0 0;
}


.stat-item:nth-child(1) .stat-label::before { content: '⚡'; }
.stat-item:nth-child(2) .stat-label::before { content: '📊'; }
.stat-item:nth-child(3) .stat-label::before { content: '📈'; }
.stat-item:nth-child(4) .stat-label::before { content: '📉'; }

.stat-value {
    font-size: clamp(1rem, 2vw, 1rem);
    font-weight: 700;
    color: var(--secondary-color);
    font-family: 'Poppins', monospace;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-modal-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: clamp(1rem, 3vw, 1.5rem);
    align-items: center;
    padding: clamp(1.25rem, 3vw, 1.5rem) clamp(1.5rem, 4vw, 2rem);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0 0 24px 24px;
}

.node-selector {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.05), rgba(38, 70, 83, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(42, 157, 143, 0.1);
}

.node-selector > label {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: clamp(0.9rem, 2vw, 0.95rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.node-selector > label::before {
    content: '🔄';
    font-size: 1.1em;
}

/* ========== ENHANCED NODE COMPARISON CHECKBOXES ========== */
.node-checkboxes {
    display: flex;
    gap: clamp(0.75rem, 2vw, 1rem);
    align-items: center;
    flex-wrap: wrap;
}

.node-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
    color: #64748b;
    transition: all 0.3s ease;
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    user-select: none;
}

.node-checkboxes label:hover {
    background: white;
    color: var(--primary-color);
    border-color: rgba(42, 157, 143, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(42, 157, 143, 0.1);
}

/* Custom checkbox styling */
.node-checkboxes input[type="checkbox"] {
    display: none; /* Hide the default checkbox */
}

.node-checkboxes input[type="checkbox"] + label::before {
    content: '';
    width: clamp(16px, 3vw, 18px);
    height: clamp(16px, 3vw, 18px);
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: white;
    display: inline-block;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.node-checkboxes input[type="checkbox"]:checked + label::before {
    background: var(--primary-color);
    border-color: var(--primary-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 70%;
}

.node-checkboxes input[type="checkbox"]:checked + label {
    background: rgba(42, 157, 143, 0.1);
    color: var(--primary-color);
    border: 2px solid rgba(42, 157, 143, 0.3);
    box-shadow: 0 4px 12px rgba(42, 157, 143, 0.15);
    font-weight: 600;
}

/* Dark theme support */
body.dark-theme .node-checkboxes label {
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
}

body.dark-theme .node-checkboxes input[type="checkbox"] + label::before {
    border-color: #4b5563;
    background: #374151;
}

body.dark-theme .node-checkboxes label:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-color);
}

body.dark-theme .node-checkboxes input[type="checkbox"]:checked + label {
    background: rgba(42, 157, 143, 0.2);
    color: var(--primary-color);
    border-color: rgba(42, 157, 143, 0.4);
}

/* Alternative: Different checkmark for dark mode */
body.dark-theme .node-checkboxes input[type="checkbox"]:checked + label::before {
    background: #e9c46a; /* Use accent color instead of primary */
    border-color: #e9c46a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z' fill='%23264653'/%3E%3C/svg%3E");
}
.node-comparison-top {
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.08), rgba(38, 70, 83, 0.08));
    border-radius: 16px;
    padding: clamp(1.25rem, 3vw, 1.5rem);
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
    border: 1px solid rgba(42, 157, 143, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.node-comparison-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--secondary-color));
    border-radius: 16px 16px 0 0;
}

.comparison-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.comparison-header h4 {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.comparison-header h4 i {
    color: var(--primary-color);
    font-size: 1.1em;
}

.comparison-hint {
    font-size: clamp(0.8rem, 2vw, 0.85rem);
    color: #64748b;
    font-style: italic;
}

.node-comparison-top .node-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
    gap: 0.75rem;
}

.node-comparison-top .checkbox-item {
    position: relative;
}

.node-comparison-top .checkbox-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: clamp(0.75rem, 2vw, 1rem);
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: clamp(0.75rem, 2vw, 0.875rem) clamp(1.5rem, 3vw, 2rem);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: clamp(0.9rem, 2vw, 0.95rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.export-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(42, 157, 143, 0.4);
}

.export-btn:hover::before {
    width: 300px;
    height: 300px;
}

.export-btn:active {
    transform: translateY(0);
}

.export-btn i {
    font-size: 1.1em;
}

/* Animations */
@keyframes slideUpChart {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
/* ========== STATUS INDICATOR STYLES ========== */
.status-text.online {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.status-text.lagging {
    background: rgba(234, 179, 8, 0.1);
    color: #ca8a04;
}

.status-text.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Also add these for the status-indicator */
.status-indicator.online {
    background-color: #10b981 !important;
    box-shadow: 
        0 0 0 3px rgba(16, 185, 129, 0.2),
        0 0 20px rgba(16, 185, 129, 0.5);
    animation: pulseOnline 2s infinite;
}

.status-indicator.lagging {
    background-color: #f59e0b !important;
    box-shadow: 
        0 0 0 3px rgba(245, 158, 11, 0.2),
        0 0 20px rgba(245, 158, 11, 0.5);
    animation: pulseWarning 2s infinite;
}

.status-indicator.offline {
    background-color: #ef4444 !important;
    box-shadow: 
        0 0 0 3px rgba(239, 68, 68, 0.2),
        0 0 20px rgba(239, 68, 68, 0.5);
}

.status-indicator {
    display: inline-block;
    width: clamp(8px, 2vw, 12px);
    height: clamp(8px, 2vw, 12px);
    border-radius: 50%;
    margin-right: clamp(6px, 1.5vw, 8px);
    background-color: #94a3b8;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    position: relative;
    flex-shrink: 0;
}

.status-indicator.active {
    background-color: #10b981 !important;
    box-shadow: 
        0 0 0 3px rgba(16, 185, 129, 0.2),
        0 0 20px rgba(16, 185, 129, 0.5);
    animation: pulseOnline 2s infinite;
}

.status-indicator.warning {
    background-color: #f59e0b !important;
    box-shadow: 
        0 0 0 3px rgba(245, 158, 11, 0.2),
        0 0 20px rgba(245, 158, 11, 0.5);
    animation: pulseWarning 2s infinite;
}

.status-indicator.inactive {
    background-color: #ef4444 !important;
    box-shadow: 
        0 0 0 3px rgba(239, 68, 68, 0.2),
        0 0 20px rgba(239, 68, 68, 0.5);
}

@keyframes pulseOnline {
    0%, 100% {
        box-shadow: 
            0 0 0 3px rgba(16, 185, 129, 0.2),
            0 0 20px rgba(16, 185, 129, 0.5);
    }
    50% {
        box-shadow: 
            0 0 0 6px rgba(16, 185, 129, 0.1),
            0 0 30px rgba(16, 185, 129, 0.6);
    }
}

@keyframes pulseWarning {
    0%, 100% {
        box-shadow: 
            0 0 0 3px rgba(245, 158, 11, 0.2),
            0 0 20px rgba(245, 158, 11, 0.5);
    }
    50% {
        box-shadow: 
            0 0 0 6px rgba(245, 158, 11, 0.1),
            0 0 30px rgba(245, 158, 11, 0.6);
    }
}

/* ========== ENHANCED LAST UPDATE STYLES ========== */

.last-update {
    font-size: clamp(0.75rem, 2vw, 0.8rem);
    color: #64748b;
    font-style: normal;
    padding: clamp(0.3rem, 1vw, 0.375rem) clamp(0.6rem, 2vw, 0.75rem);
    background: rgba(0, 0, 0, 0.03);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: clamp(0.3rem, 1vw, 0.375rem);
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(200px, 60vw);
}

.last-update::before {
    content: '🕒';
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    opacity: 0.8;
}

body.dark-theme .last-update {
    color: var(--primary-color);
}
/* ========== NODE HEADER LAYOUT ENHANCEMENT ========== */

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
    padding-bottom: clamp(1rem, 3vw, 1.25rem);
    border-bottom: 2px solid #f1f5f9;
    gap: clamp(1rem, 3vw, 1.5rem);
    flex-wrap: wrap;
}

.status-group {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1rem);
    flex-wrap: wrap;
}

/* ========== ANIMATIONS ========== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes dataUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ========== DARK THEME STYLES ========== */

/* Dark theme general */
body.dark-theme .sensor-section,
body.dark-theme .sensor-section h2,
body.dark-theme .sensor-section h3,
body.dark-theme .sensor-section div {
    color: var(--dark-text-color) !important;
}

body.dark-theme .info-subtitle,
body.dark-theme .feature-card p,
body.dark-theme .description-text,
body.dark-theme .member-name,
body.dark-theme .affiliation-detail,
body.dark-theme .image-description p,
body.dark-theme .node-info span,
body.dark-theme .telegram-subtitle,
body.dark-theme .telegram-description,
body.dark-theme .qr-step span,
body.dark-theme .threshold-subtitle,
body.dark-theme .legend-desc,
body.dark-theme .sensor-desc,
body.dark-theme .info-content p,
body.dark-theme .info-content li,
body.dark-theme .score-label,
body.dark-theme #telegram-section .telegram-subtitle,
body.dark-theme .chart-modal-header h3,
body.dark-theme .comparison-hint ,
body.dark-theme #telegram-section .telegram-description {
    color: #ccc !important;
}

body.dark-theme .description-header,
body.dark-theme .team-section,
body.dark-theme .section-header,
body.dark-theme .chart-controls,
body.dark-theme .chart-stats,
body.dark-theme .chart-modal-footer {
    border-color: var(--dark-border) !important;
}

body.dark-theme .feature-card,
body.dark-theme .description-card,
body.dark-theme .trinode-image-section,
body.dark-theme .admin-section,
body.dark-theme .radio-option label,
body.dark-theme .threshold-control,
body.dark-theme .threshold-instructions-container,
body.dark-theme .admin-panel-card,
body.dark-theme .stat-item,
body.dark-theme .score-item,
body.dark-theme .info-card,
body.dark-theme #telegram-section .telegram-card,
body.dark-theme .qr-modal-content,
body.dark-theme .chart-container,
body.dark-theme .chart-modal-content {
    background: #2c2c2c !important;
    border-color: var(--dark-border) !important;
    box-shadow: var(--dark-shadow) !important;
}

body.dark-theme .dashboard-controls,
body.dark-theme .dashboard-selector,
body.dark-theme .qr-modal-footer,
body.dark-theme .qr-modal-header,
body.dark-theme .chart-modal-header {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .legend-item,
body.dark-theme .team-member,
body.dark-theme .node-detail,
body.dark-theme .handle-container,
body.dark-theme .telegram-note,
body.dark-theme .admin-note,
body.dark-theme .team-affiliation,
body.dark-theme .threshold-value-display,
body.dark-theme .value-display.loading::after {
    background: rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .gauge-card,
body.dark-theme .value-container,
body.dark-theme .sensor-node-section,
body.dark-theme #dashboard-section {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.dark-theme .gauge-background,
body.dark-theme .gauge-track {
    stroke: #475569 !important;
    background: #475569 !important;
}

body.dark-theme .gauge-value,
body.dark-theme .value-number,
body.dark-theme .stat-value,
body.dark-theme .score-value,
body.dark-theme .node-header h3,
body.dark-theme .gauge-header h4,
body.dark-theme .value-header h4,
body.dark-theme .sensor-details strong,
body.dark-theme .legend-label,
body.dark-theme .info-content h4,
body.dark-theme .section-header h3,
body.dark-theme .radio-label strong,
body.dark-theme .threshold-header label,
body.dark-theme .info-header h3,
body.dark-theme .image-description h4,
body.dark-theme .description-header h4,
body.dark-theme .team-section h5,
body.dark-theme .info-header h3,
body.dark-theme .qr-handle-large,
.gauge-header h4 , 
body.dark-theme .comparison-header h4,
body.dark-theme #telegram-section .telegram-handle,
body.dark-theme .qr-modal-header h3{
    color: var(--primary-color) !important;
}

body.dark-theme .gauge-label,
body.dark-theme .value-unit,
body.dark-theme .gauge-labels,
body.dark-theme .stat-label,
body.dark-theme .node-checkboxes label,
body.dark-theme .chart-controls label,
body.dark-theme .telegram-features .feature span,
body.dark-theme .admin-panel-subtitle,
body.dark-theme .selector-label {
    color: var(--primary-color) !important;
}

/* ========== MINIMAL RESPONSIVE BREAKPOINTS ========== */

/* Tablet and below - simplified layout adjustments */
@media (max-width: 768px) {
    .node-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .status-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .siren-options,
    .features-grid,
    .threshold-controls-grid,
    .team-grid,
    .node-details,
    .threshold-info,
    .telegram-features,
    .chart-stats {
        grid-template-columns: 1fr !important;
    }
    
    #telegram-section .telegram-card {
        flex-direction: column;
        text-align: center;
    }
    
    .chart-modal-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .node-checkboxes {
        justify-content: center;
    }
        .chart-modal-footer {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .chart-controls {
        grid-template-columns: 1fr;
    }
    
    .node-checkboxes {
        justify-content: center;
    }
    
    .chart-modal-content {
        max-height: 95vh;
    }
        .tab-container {
        grid-auto-columns: minmax(80px, 1fr); /* Smaller minimum on mobile */
        padding-bottom: 0.35rem;
    }
    
    .tab-container .tab-button {
        font-size: clamp(0.8rem, 1.8vw, 0.9rem);
        padding: clamp(0.6rem, 1.5vw, 0.8rem);
        min-height: 45px; /* Slightly smaller on mobile */
        white-space: normal; /* Allow text to wrap */
        word-break: break-word;
        line-height: 1.2;
    }
    
    .tab-container .tab-button.active::after {
        height: 3px; /* Thinner line on mobile */
    }
    
    /* Adjust the tab footer to match */
    .tab-footer {
        padding-top: 0.25rem;
    }
     .trinode-main-image {
        max-height: 60vh; 
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .sensor-section,
    .admin-panel-card,
    .threshold-instructions-container {
        padding: 1rem !important;
        margin: 0.5rem auto !important;
        border-radius: 12px !important;
    }
    
    .gauge-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .tab-container .tab-button {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
    
    .status-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .chart-modal-content {
        border-radius: 16px;
        padding: 0.5rem;
    }
    
    .chart-modal-header {
        padding: 1rem;
    }
    
    .chart-modal-body {
        padding: 1rem;
        gap: 1rem;
    }
    
    .chart-container {
        height: 250px;
        padding: 0.75rem;
    }
    
    .chart-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .node-checkboxes {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .node-checkboxes label {
        justify-content: center;
    }
    .tab-container {
        grid-auto-columns: minmax(70px, 1fr);
        min-height: 50px;
    }
    
    .tab-container .tab-button {
        font-size: 0.75rem;
        padding: 0.5rem 0.3rem;
        min-height: 40px;
        line-height: 1.1;
    }
    
    .tab-container .tab-button.active::after {
        height: 2px;
    }
    .trinode-main-image {
        max-height: 50vh;
    }
}

/* Print styles */
@media print {
    #dashboard-section,
    .sensor-section,
    .threshold-instructions-container,
    .admin-panel-card {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    .dashboard-controls,
    .chart-menu,
    .qr-container,
    .telegram-btn,
    .export-btn,
    .reset-btn,
    .logout-btn,
    .admin-login-btn,
    .chart-modal-close,
    .qr-modal-close {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #0066cc;
        --secondary-color: #003366;
        --accent-color: #ff9900;
        --text-color: #000000;
        --dark-text-color: #ffffff;
    }
    
    .sensor-section,
    .gauge-card,
    .value-container,
    .feature-card {
        border: 2px solid var(--border);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .gauge-card:hover,
    .value-container:hover,
    .feature-card:hover,
    .node-detail:hover,
    .team-member:hover,
    .radio-option label:hover,
    .threshold-control:hover {
        transform: none !important;
    }
}


/* ========== SUMMARY STATUS SECTION STYLES ========== */

#summary-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: none;
    padding: clamp(1rem, 3vw, 2rem);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    max-width: min(1400px, 95vw);
    margin: clamp(1rem, 3vw, 2rem) auto;
}

.summary-container {
    background: white;
    border-radius: 16px;
    padding: clamp(2rem, 5vw, 3rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

/* Summary Header */
.summary-header {
    text-align: center;
    margin-bottom: clamp(2rem, 5vw, 3rem);
    padding-bottom: clamp(1.5rem, 4vw, 2rem);
    border-bottom: 2px solid var(--light-gray);
}

.summary-icon {
    width: clamp(80px, 20vw, 100px);
    height: clamp(80px, 20vw, 100px);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 30px rgba(42, 157, 143, 0.3);
    animation: float 3s ease-in-out infinite;
}

.summary-icon i {
    font-size: clamp(2rem, 5vw, 3rem);
    color: white;
}

#summary-section h2 {
    color: var(--secondary-color) !important;
    background: none !important;
    -webkit-text-fill-color: var(--secondary-color) !important;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 0.5rem;
}

.summary-subtitle {
    color: #666;
    font-size: clamp(0.9rem, 2vw, 1rem);
    font-weight: 500;
    letter-spacing: 1px;
    max-width: min(600px, 95vw);
    margin: 0 auto;
}

/* Summary Statistics */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
    margin-bottom: clamp(2rem, 5vw, 3rem);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 3vw, 1.5rem);
    padding: clamp(1.25rem, 3vw, 1.5rem);
    background: #f8f9fa;
    border-radius: 16px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.stat-icon {
    width: clamp(60px, 15vw, 70px);
    height: clamp(60px, 15vw, 70px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: white;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    color: #666;
    font-weight: 500;
}

/* Trend Analysis */
.trend-analysis {
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.05), rgba(38, 70, 83, 0.05));
    border-radius: 20px;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: clamp(2rem, 5vw, 3rem);
    border: 1px solid rgba(42, 157, 143, 0.1);
}

.trend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(1.5rem, 4vw, 2rem);
    flex-wrap: wrap;
    gap: 1rem;
}

.trend-header h3 {
    color: var(--secondary-color);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.trend-header h3 i {
    color: var(--primary-color);
}

.trend-select {
    padding: clamp(0.6rem, 2vw, 0.75rem) clamp(1rem, 3vw, 1.25rem);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #374151;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2vw, 0.9rem);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232a9d8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.trend-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

.trend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: clamp(1.5rem, 4vw, 2rem);
}

.trend-card {
    background: white;
    border-radius: 16px;
    padding: clamp(1.25rem, 3vw, 1.5rem);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.trend-card.rising {
    border-color: rgba(231, 111, 81, 0.2);
    border-left: 4px solid #e76f51;
}

.trend-card.dropping {
    border-color: rgba(42, 157, 143, 0.2);
    border-left: 4px solid #2a9d8f;
}

.trend-card.stable {
    border-color: rgba(233, 196, 106, 0.2);
    border-left: 4px solid #e9c46a;
}

.trend-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.trend-card-header {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1rem);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
}

.trend-icon {
    width: clamp(45px, 12vw, 50px);
    height: clamp(45px, 12vw, 50px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.1rem, 3vw, 1.25rem);
}

.trend-card.rising .trend-icon {
    background: rgba(231, 111, 81, 0.1);
    color: #e76f51;
}

.trend-card.dropping .trend-icon {
    background: rgba(42, 157, 143, 0.1);
    color: #2a9d8f;
}

.trend-card.stable .trend-icon {
    background: rgba(233, 196, 106, 0.1);
    color: #e9c46a;
}

.trend-card-header h4 {
    flex: 1;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    color: var(--secondary-color);
    margin: 0;
}

.trend-count {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    font-family: 'Poppins', monospace;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    min-width: 40px;
    text-align: center;
}

.trend-card.rising .trend-count {
    background: rgba(231, 111, 81, 0.1);
    color: #e76f51;
}

.trend-card.dropping .trend-count {
    background: rgba(42, 157, 143, 0.1);
    color: #2a9d8f;
}

.trend-card.stable .trend-count {
    background: rgba(233, 196, 106, 0.1);
    color: #e9c46a;
}

.trend-list {
    flex: 1;
    overflow-y: auto;
    max-height: 200px;
    padding-right: 0.5rem;
}

.trend-list::-webkit-scrollbar {
    width: 6px;
}

.trend-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.trend-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.trend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.trend-item:hover {
    background: white;
    border-color: #e2e8f0;
    transform: translateX(5px);
}

.trend-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.trend-item.rising .trend-item-icon {
    background: rgba(231, 111, 81, 0.1);
    color: #e76f51;
}

.trend-item.dropping .trend-item-icon {
    background: rgba(42, 157, 143, 0.1);
    color: #2a9d8f;
}

.trend-item.stable .trend-item-icon {
    background: rgba(233, 196, 106, 0.1);
    color: #e9c46a;
}

.trend-item-content {
    flex: 1;
    min-width: 0;
}

.trend-item-title {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trend-item-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #666;
}

.trend-value {
    font-weight: 700;
    font-family: 'Poppins', monospace;
}

.trend-change {
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
}

.trend-item.rising .trend-change {
    background: rgba(231, 111, 81, 0.1);
    color: #e76f51;
}

.trend-item.dropping .trend-change {
    background: rgba(42, 157, 143, 0.1);
    color: #2a9d8f;
}

.trend-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #94a3b8;
    gap: 0.75rem;
}

.trend-placeholder i {
    font-size: 2rem;
    opacity: 0.5;
}

.trend-placeholder p {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Node Overview */
.node-overview {
    margin-bottom: clamp(2rem, 5vw, 3rem);
}

.node-overview h3 {
    color: var(--secondary-color);
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.node-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: clamp(1rem, 3vw, 1.5rem);
}

.node-card {
    background: white;
    border-radius: 16px;
    padding: clamp(1.25rem, 3vw, 1.5rem);
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.node-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.node-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
}

.node-card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    color: var(--secondary-color);
    font-weight: 600;
}

.node-card-status {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.node-card-status.online {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.node-card-status.warning {
    background: rgba(234, 179, 8, 0.1);
    color: #ca8a04;
}

.node-card-status.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.node-card-sensors {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.node-sensor-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.8rem;
}

.node-sensor-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
}

.node-sensor-item.danger .node-sensor-icon {
    background: #e76f51;
}

.node-sensor-item.warning .node-sensor-icon {
    background: #e9c46a;
}

.node-sensor-item.normal .node-sensor-icon {
    background: #2a9d8f;
}

.node-sensor-value {
    font-weight: 700;
    font-family: 'Poppins', monospace;
}




.action-buttons {
    display: flex;
    gap: clamp(1rem, 3vw, 1.5rem);
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: min(150px, 100%);
    padding: clamp(0.875rem, 2vw, 1rem);
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.9rem, 2vw, 0.95rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.refresh-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.telegram-btn {
    background: linear-gradient(135deg, #0088cc, #006b99);
    color: white;
}

.chart-btn {
    background: linear-gradient(135deg, #e9c46a, #f4a261);
    color: var(--secondary-color);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.action-btn:active {
    transform: translateY(0);
}

/* Dark Theme Support */
body.dark-theme #summary-section {
    background: var(--dark-background) !important;
}

body.dark-theme .summary-container {
    background: #2c2c2c;
    border-color: var(--dark-border);
    box-shadow: var(--dark-shadow);
}

body.dark-theme .stat-card {
    background: #1e1e1e;
    border-color: #444;
}

body.dark-theme .stat-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body.dark-theme .stat-label {
    color: #bbb !important;
}

body.dark-theme .trend-analysis {
    background: rgba(42, 157, 143, 0.05);
    border-color: rgba(42, 157, 143, 0.2);
}

body.dark-theme .trend-select {
    background: #374151;
    border-color: #4b5563;
    color: var(--primary-color);
}

body.dark-theme .trend-card {
    background: #1e1e1e;
    border-color: #444;
}

body.dark-theme .trend-card-header {
    border-bottom-color: #444;
}

body.dark-theme .trend-item {
    background: #2c2c2c;
    border-color: #444;
}

body.dark-theme .trend-item:hover {
    background: #374151;
    border-color: #555;
}

body.dark-theme .trend-placeholder {
    color: #94a3b8;
}

body.dark-theme .node-card {
    background: #1e1e1e;
    border-color: #444;
}

body.dark-theme .node-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body.dark-theme .node-card-header {
    border-bottom-color: #444;
}

body.dark-theme .node-sensor-item {
    background: #2c2c2c;
}


/* Responsive Design */
@media (max-width: 768px) {
    .trend-grid,
    .node-cards {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .trend-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .node-card-sensors {
        grid-template-columns: 1fr;
    }
}

/* ========== RESPONSIVE SUMMARY STATUS SECTION ========== */

#summary-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: none;
    padding: clamp(0.75rem, 2vw, 2rem);
    border-radius: clamp(12px, 2vw, 20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    max-width: min(1400px, 98vw);
    margin: clamp(0.5rem, 2vw, 2rem) auto;
    width: 100%;
    box-sizing: border-box;
}

.summary-container {
    background: white;
    border-radius: clamp(12px, 2vw, 16px);
    padding: clamp(1rem, 3vw, 3rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    width: 100%;
    overflow: hidden;
}

/* Summary Header - Improved for Mobile */
.summary-header {
    text-align: center;
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
    padding-bottom: clamp(1rem, 3vw, 2rem);
    border-bottom: 2px solid var(--light-gray);
}

.summary-icon {
    width: clamp(60px, 18vw, 100px);
    height: clamp(60px, 18vw, 100px);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto clamp(1rem, 3vw, 1.5rem);
    box-shadow: 0 6px 20px rgba(42, 157, 143, 0.2);
    animation: float 3s ease-in-out infinite;
}

.summary-icon i {
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: white;
}

#summary-section h2 {
    color: var(--secondary-color) !important;
    background: none !important;
    -webkit-text-fill-color: var(--secondary-color) !important;
    font-size: clamp(1.25rem, 4vw, 2.5rem);
    margin-bottom: clamp(0.5rem, 2vw, 1rem);
    line-height: 1.2;
    word-wrap: break-word;
    padding: 0 0.5rem;
}

.summary-subtitle {
    color: #666;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    font-weight: 500;
    letter-spacing: 0.5px;
    max-width: min(600px, 95%);
    margin: 0 auto;
    line-height: 1.4;
    padding: 0 0.5rem;
}

/* Summary Statistics - Enhanced Responsive Grid */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: clamp(0.75rem, 2vw, 1.5rem);
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    padding: clamp(1rem, 2.5vw, 1.5rem);
    background: #f8f9fa;
    border-radius: clamp(10px, 2vw, 16px);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: clamp(90px, 20vw, 110px);
    box-sizing: border-box;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.stat-icon {
    width: clamp(50px, 12vw, 70px);
    height: clamp(50px, 12vw, 70px);
    border-radius: clamp(8px, 2vw, 12px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon i {
    font-size: clamp(1.25rem, 3vw, 2rem);
    color: white;
}

.stat-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.stat-value {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: clamp(0.25rem, 1vw, 0.5rem);
    line-height: 1;
    font-family: 'Poppins', monospace;
}

.stat-label {
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    color: #666;
    font-weight: 500;
    line-height: 1.2;
}

/* Special handling for rain stat card */
.stat-card:nth-child(4) .stat-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.stat-card:nth-child(4) .stat-value {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

/* Trend Analysis */
.trend-analysis {
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.05), rgba(38, 70, 83, 0.05));
    border-radius: clamp(12px, 2vw, 20px);
    padding: clamp(1rem, 3vw, 2.5rem);
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
    border: 1px solid rgba(42, 157, 143, 0.1);
}

.trend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(1rem, 3vw, 2rem);
    flex-wrap: wrap;
    gap: 1rem;
    row-gap: 0.5rem;
}

.trend-header h3 {
    color: var(--secondary-color);
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    line-height: 1.2;
}

.trend-header h3 i {
    color: var(--primary-color);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.trend-select {
    padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(0.75rem, 2vw, 1.25rem);
    border: 2px solid #e2e8f0;
    border-radius: clamp(8px, 2vw, 12px);
    background: white;
    color: #374151;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232a9d8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    padding-right: 2.25rem;
    min-width: 160px;
    max-width: 100%;
    box-sizing: border-box;
}

.trend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: clamp(1rem, 3vw, 2rem);
}

.trend-card {
    background: white;
    border-radius: clamp(12px, 2vw, 16px);
    padding: clamp(1rem, 2.5vw, 1.5rem);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: clamp(280px, 60vw, 350px);
    box-sizing: border-box;
}

.trend-card-header {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1.5vw, 1rem);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f1f5f9;
    flex-wrap: wrap;
}

.trend-icon {
    width: clamp(40px, 10vw, 50px);
    height: clamp(40px, 10vw, 50px);
    border-radius: clamp(8px, 2vw, 12px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    flex-shrink: 0;
}

.trend-card-header h4 {
    flex: 1;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: var(--secondary-color);
    margin: 0;
    min-width: 120px;
}

.trend-count {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 700;
    font-family: 'Poppins', monospace;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    min-width: 35px;
    text-align: center;
    flex-shrink: 0;
}

.trend-list {
    flex: 1;
    overflow-y: auto;
    max-height: clamp(200px, 40vw, 250px);
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f5f9;
}

/* Custom scrollbar for WebKit browsers */
.trend-list::-webkit-scrollbar {
    width: 4px;
}

.trend-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.trend-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.trend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.trend-item-icon {
    width: clamp(30px, 8vw, 36px);
    height: clamp(30px, 8vw, 36px);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    flex-shrink: 0;
}

.trend-item-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.trend-item-title {
    display: block;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trend-item-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(0.7rem, 1.8vw, 0.75rem);
    color: #666;
}

.trend-value {
    font-weight: 700;
    font-family: 'Poppins', monospace;
}

.trend-change {
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: clamp(0.65rem, 1.5vw, 0.7rem);
    white-space: nowrap;
}

.trend-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: clamp(150px, 30vw, 200px);
    color: #94a3b8;
    gap: 0.75rem;
    text-align: center;
    padding: 1rem;
}

.trend-placeholder i {
    font-size: clamp(1.5rem, 4vw, 2rem);
    opacity: 0.5;
}

.trend-placeholder p {
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    opacity: 0.7;
    margin: 0;
}

/* Node Overview */
.node-overview {
    margin-bottom: clamp(1.5rem, 4vw, 3rem);
}

.node-overview h3 {
    color: var(--secondary-color);
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
    line-height: 1.2;
}

.node-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: clamp(0.75rem, 2vw, 1.5rem);
}

.node-card {
    background: white;
    border-radius: clamp(10px, 2vw, 16px);
    padding: clamp(1rem, 2.5vw, 1.5rem);
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.node-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.node-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: var(--secondary-color);
    font-weight: 600;
    flex: 1;
    min-width: 150px;
}

.node-card-status {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: clamp(0.65rem, 1.5vw, 0.75rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.node-card-sensors {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.5rem;
}

.node-sensor-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: clamp(0.75rem, 2vw, 0.8rem);
    min-width: 0;
}

.node-sensor-icon {
    width: clamp(20px, 6vw, 24px);
    height: clamp(20px, 6vw, 24px);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.65rem, 1.5vw, 0.7rem);
    color: white;
    flex-shrink: 0;
}

.node-sensor-value {
    font-weight: 700;
    font-family: 'Poppins', monospace;
    font-size: clamp(0.8rem, 2vw, 0.85rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: clamp(0.75rem, 2vw, 1.5rem);
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn {
    flex: 1;
    min-width: min(140px, 100%);
    max-width: 300px;
    padding: clamp(0.75rem, 2vw, 1rem);
    border: none;
    border-radius: clamp(8px, 2vw, 12px);
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-sizing: border-box;
}

.action-btn i {
    font-size: clamp(0.9rem, 2.2vw, 1rem);
}

/* ================================================
TREND PERCENTAGE STYLES
================================================ */

.trend-change.positive {
    color: #10b981;
    font-weight: 600;
}

.trend-change.negative {
    color: #ef4444;
    font-weight: 600;
}

/* New change intensity classes */
.trend-change.critical {
    color: #dc2626;
    font-weight: 700;
    animation: pulse-critical 1s infinite;
}

.trend-change.extreme {
    color: #ea580c;
    font-weight: 700;
}

.trend-change.high {
    color: #f59e0b;
    font-weight: 600;
}

.trend-change.moderate {
    color: #84cc16;
    font-weight: 600;
}

.trend-change.low {
    color: #6b7280;
    font-weight: 500;
}

.trend-change.stable {
    color: #9ca3af;
    font-weight: 400;
}

/* Trend icons */
.critical-icon {
    color: #dc2626;
    animation: pulse-icon 1s infinite;
}

.extreme-icon {
    color: #ea580c;
}

.high-icon {
    color: #f59e0b;
}

.moderate-icon {
    color: #84cc16;
}

.low-icon {
    color: #6b7280;
}

.stable-icon {
    color: #9ca3af;
}

/* Animations */
@keyframes pulse-critical {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Optional: Add tooltip for extreme values */
.trend-change[title] {
    cursor: help;
    border-bottom: 1px dotted #9ca3af;
}
/* ========== RESPONSIVE BREAKPOINTS ========== */

/* Mobile Phones (Portrait) */
@media (max-width: 480px) {
    .summary-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        min-height: 80px;
    }
    
    .trend-grid,
    .node-cards {
        grid-template-columns: 1fr;
    }
    
    .trend-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .trend-select {
        width: 100%;
        max-width: none;
    }
    
    .node-card-sensors {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        max-width: none;
    }
    
    /* Hide rain stat labels on very small screens */
    .stat-card:nth-child(4) .stat-label {
        font-size: 0.7rem;
    }
}

/* Mobile Phones (Landscape) and Small Tablets */
@media (min-width: 481px) and (max-width: 767px) {
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .trend-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .node-cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .trend-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .trend-select {
        width: 100%;
        max-width: 250px;
    }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 1023px) {
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .trend-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .trend-card:last-child {
        grid-column: span 2;
        max-width: calc(50% - 1rem);
        justify-self: center;
    }
}

/* Large Tablets and Small Desktops */
@media (min-width: 1024px) and (max-width: 1279px) {
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .trend-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .node-cards {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Desktop and Larger */
@media (min-width: 1280px) {
    .summary-stats {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .trend-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .node-cards {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Very Large Screens */
@media (min-width: 1600px) {
    .summary-container {
        padding: clamp(2rem, 4vw, 4rem);
    }
    
    .trend-grid {
        gap: clamp(1.5rem, 3vw, 3rem);
    }
    
    .node-cards {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .stat-card:hover,
    .trend-card:hover,
    .node-card:hover {
        transform: none;
    }
    
    .stat-card:active,
    .trend-card:active,
    .node-card:active {
        transform: scale(0.98);
    }
    
    .action-btn:hover {
        transform: none;
    }
    
    .action-btn:active {
        transform: scale(0.98);
    }
    
    .trend-select {
        min-height: 44px; /* Better touch target */
    }
    
    .action-btn {
        min-height: 44px; /* Better touch target */
    }
}

/* Print Styles */
@media print {
    #summary-section {
        box-shadow: none;
        background: white !important;
        border: 1px solid #ddd;
    }
    
    .summary-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .trend-list {
        max-height: none;
        overflow: visible;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .summary-icon,
    .stat-card,
    .trend-card,
    .node-card,
    .action-btn {
        animation: none;
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .stat-card,
    .trend-card,
    .node-card {
        border-width: 2px;
    }
    
    .trend-card.rising,
    .trend-card.dropping,
    .trend-card.stable {
        border-left-width: 4px;
    }
}

/* Dark Theme (keep your existing dark theme styles, but add responsive adjustments) */
@media (max-width: 768px) {
    body.dark-theme .trend-list::-webkit-scrollbar-track {
        background: #374151;
    }
    
    body.dark-theme .trend-select {
        font-size: clamp(0.8rem, 2vw, 0.9rem);
        min-height: 40px;
    }
}

/* Landscape orientation for mobile */
@media (max-height: 600px) and (orientation: landscape) {
    #summary-section {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .trend-card {
        min-height: 200px;
    }
    
    .trend-list {
        max-height: 120px;
    }
}