:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(22, 28, 45, 0.45);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --neon-green: #10b981;
    --neon-glow: rgba(59, 130, 246, 0.35);
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.background-decor {
    position: absolute;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
}

.c1 {
    width: 400px;
    height: 400px;
    background: #3b82f6;
    top: -10%;
    left: -10%;
}

.c2 {
    width: 500px;
    height: 500px;
    background: #8b5cf6;
    bottom: -15%;
    right: -10%;
}

.container {
    width: 96%;
    max-width: 1800px;
    z-index: 10;
    padding: 20px 0;
}

/* Sub-Tab navigation styles */
.sub-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 12px;
}

.sub-tab-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sub-tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.sub-tab-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 12px var(--neon-glow);
}

/* Device Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: bold;
}
.badge-online {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}
.badge-standby {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}
.badge-offline {
    background: rgba(100, 116, 139, 0.15);
    border: 1px solid rgba(100, 116, 139, 0.4);
    color: #94a3b8;
}
.badge-private {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.logo h1 {
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
}

.logo h1 span {
    font-weight: 300;
    color: var(--text-secondary);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-icon {
    width: 8px;
    height: 8px;
    background-color: #34d399;
    border-radius: 50%;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 25px;
}

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

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--neon-glow);
    background: rgba(255, 255, 255, 0.08);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 45px;
}

.btn-icon {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--text-primary);
}

.btn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: white;
    box-shadow: 0 4px 15px var(--neon-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.logs-card {
    display: flex;
    flex-direction: column;
    height: 480px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.card-header h2 {
    margin-bottom: 0;
}

.log-container {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 15px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-container::-webkit-scrollbar {
    width: 6px;
}
.log-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.log-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
.log-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.log-line {
    word-break: break-all;
    line-height: 1.4;
    color: #cbd5e1;
}

.log-line.system-msg {
    color: #60a5fa;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.toast-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1000;
}

.toast {
    background: rgba(16, 28, 45, 0.95);
    border: 1px solid var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    margin-top: 10px;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

.toast.error {
    border-color: #ef4444;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(10px); }
}

/* Auth & Modal Styles */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.lock-status {
    font-size: 0.8rem;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.lock-status.unlocked {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-card {
    background: #111827;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    width: 380px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Auth Wrapper Screen */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 10;
    position: relative;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.4s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    height: 50px;
    object-fit: contain;
    margin-bottom: 15px;
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Portal & Navigation Custom Styles */
.nav-menu {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--card-border);
}

.nav-link.active {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--neon-glow);
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.portal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    cursor: pointer;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.portal-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 15px 30px rgba(59, 130, 246, 0.25);
}

.portal-card.relay:hover {
    border-color: #8b5cf6;
    box-shadow: 0 15px 30px rgba(139, 92, 246, 0.25);
}

.portal-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.portal-card h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.portal-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}


