/* Base Reset & Layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #e0f2fe; /* Light sky blue base fallback */
    min-height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    color: #0f172a; /* Dark slate text for excellent contrast on light card */
    padding: 1.5rem;
}

/* Fullscreen Nature Canvas Engine */
#liveBackground {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
}

/* Compact Small Glassmorphism Form Dashboard */
.portal-container {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.55); /* Bright translucent glassmorphism */
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 2.25rem 1.75rem;    /* Streamlined padding for a tight, compact look */
    border-radius: 24px;         /* Slightly tighter border radius to match small scale */
    width: 100%;                 /* Safe fluid fallback default */
    max-width: 360px;            /* Narrowed container constraint from 640px to 360px for a sharp small footprint */
    text-align: center;
    box-shadow: 0 30px 60px -15px rgba(15, 32, 67, 0.1), 
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    animation: slideUpIntro 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Scaled Small Corporate Logo Formatting */
.corporate-logo {
    max-width: 180px;            /* Brought down from 250px to fit gracefully inside the small card */
    width: 100%;
    height: auto;
    object-fit: contain;
    margin-bottom: 1.5rem;       /* Reduced gap to preserve vertical balance */
    display: inline-block;
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.06));
}

@keyframes slideUpIntro {
    0% { transform: translateY(40px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

header h1 {
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #059669, #0284c7); /* Nature Emerald to Sky Blue gradient */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.6rem;
}

header p {
    color: #475569;
    font-size: 1rem;
    margin-bottom: 2.75rem;
}

/* Interactive Mode Toggle Button Layout */
.mode-toggle-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 2.75rem;
}

.mode-label {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    transition: all 0.3s ease;
}

.text-offline { color: #94a3b8; }
.text-offline.active-mode { color: #ef4444; filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.3)); }

.text-online { color: #94a3b8; }
.text-online.active-mode { color: #059669; filter: drop-shadow(0 0 8px rgba(5, 150, 105, 0.3)); }

.toggle-btn {
    position: relative;
    width: 66px;
    height: 36px;
    background-color: #059669;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 4px;
}

.toggle-btn.offline { background-color: #ef4444; }

.toggle-slider {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 26px;
    height: 26px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.toggle-btn.offline .toggle-slider {
    transform: translateX(-30px);
}

/* Custom Dropdown Control Layout */
/* Custom Dropdown Component Framework */
.dropdown {
    position: relative;
    width: 100%;
}

.dropbtn {
    width: 100%;
    background: #ffffff;
    color: #0f172a;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}

.dropbtn:hover, .dropdown.active .dropbtn {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.arrow-icon {
    color: #64748b;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown.active .arrow-icon {
    transform: rotate(180deg);
}

/* Fully Responsive Dropdown List Container */
.dropdown-content {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    
    /* 
       DYNAMIC SCREEN CALCULATIONS: 
       Limits the height of the dropdown based on the remaining visible screen size (vh).
       Ensures it scales up on large monitors and caps gracefully on small devices.
    */
    max-height: clamp(160px, 35vh, 320px); 
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Butter smooth gesture scrolls on touchscreens */
    
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 15px 30px -5px rgba(15, 23, 42, 0.12);
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
    pointer-events: none;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 150; /* Forces list above the canvas network and UI bounds */
}

.dropdown.active .dropdown-content {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

.dropdown-content a {
    color: #334155;
    padding: 1rem 1.5rem;
    text-decoration: none;
    display: block;
    text-align: left;
    font-size: 0.95rem;
    white-space: nowrap;      /* Prevents text from wrapping into messy lines on narrow columns */
    overflow: hidden;
    text-overflow: ellipsis;  /* Elegantly truncates very long URL descriptions with dots if squeezed */
    transition: all 0.25s ease;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background: linear-gradient(90deg, rgba(2, 132, 199, 0.04), transparent);
    color: #0284c7;
    padding-left: 1.75rem;
}

/* Custom Scrollbar Optimization */
.dropdown-content::-webkit-scrollbar {
    width: 6px;
}
.dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}
.dropdown-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Full Viewport Responsive Media Adaptations */
@media (max-width: 640px) {
    .portal-container {
        padding: 3rem 1.75rem; 
        border-radius: 24px;
    }
    .corporate-logo {
        max-width: 250px; /* Responsive safe fit for smaller viewports */
    }
    header h1 {
        font-size: 2.1rem;
    }
}
