/* ==========================================
   GLOBAL VARIABLES & BODY STYLES
   ========================================== */
:root {
    --bg-gradient: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    --accent-glow: rgba(99, 102, 241, 0.15);
    --border-glow: rgba(99, 102, 241, 0.3);
    --accent-purple: #6366f1;
    --accent-cyan: #06b6d4;
    --sidebar-width: 380px;
    --glass-bg: rgba(15, 23, 42, 0.95);
    --border-color: rgba(255, 255, 255, 0.08);
}

body {
    background: var(--bg-gradient);
    font-family: 'Inter', sans-serif;
    color: #f8fafc;
    min-height: 100vh;
}

/* ==========================================
   PORTAL BACKGROUND & ORBS
   ========================================== */
.portal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.5;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
    animation: float 12s ease-in-out infinite alternate;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: #06b6d4;
    bottom: -50px;
    right: -50px;
    animation: float 8s ease-in-out infinite alternate-reverse;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 40px) scale(1.1); }
}

/* ==========================================
   GLASS CARD STYLING (Portal & Login)
   ========================================== */
.glass-card {
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 3rem;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 10;
    position: relative;
    animation: fadeIn 0.8s ease-out;
}

.login-card {
    max-width: 450px;
    text-align: left;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.title {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #f8fafc 30%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.login-card .title {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-bottom: 2.5rem;
    font-weight: 300;
    line-height: 1.6;
}

.login-card .subtitle {
    font-size: 0.95rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* ==========================================
   PREMIUM BUTTONS & LINKS
   ========================================== */
.btn-premium {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.85rem 2rem;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.02em;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.login-card .btn-premium {
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.85rem;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: white;
}

.btn-premium:active {
    transform: translateY(1px);
}

.back-link {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #64748b;
    text-decoration: none;
    transition: color 0.3s;
}

.back-link:hover {
    color: #94a3b8;
}

/* ==========================================
   FORM INPUTS & LABELS
   ========================================== */
.form-label {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control {
    background: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc !important;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    outline: none;
}

.alert-premium {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-radius: 12px;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
}

/* ==========================================
   DASHBOARD LAYOUT & MAP
   ========================================== */
.dashboard-body {
    height: 100vh;
    margin: 0;
    overflow: hidden;
    display: flex;
}

#sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    z-index: 1000;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 10px #10b981;
    animation: pulse-live 1.8s infinite;
}

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

.filter-section {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(30, 41, 59, 0.25);
}

.filter-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.form-select-custom {
    background-color: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    appearance: none;
    width: 100%;
    transition: border-color 0.2s;
}

.form-select-custom:focus {
    border-color: var(--accent-purple);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* ==========================================
   TELEMETRY STREAM LOGS
   ========================================== */
.log-section {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.event-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.event-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #64748b;
}

.event-card.status-fix::before {
    background: var(--accent-cyan);
}

.event-card.status-startup::before {
    background: var(--accent-purple);
}

.event-card:hover {
    background: rgba(30, 41, 59, 0.6);
    transform: translateX(3px);
    border-color: rgba(255, 255, 255, 0.15);
}

.event-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.event-device {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    color: #e2e8f0;
}

.event-time {
    font-size: 0.75rem;
    color: #64748b;
}

.event-details {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.event-badges {
    display: flex;
    gap: 0.35rem;
}

.badge-custom {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-wifi { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-lte { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-fix { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.badge-startup { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.badge-sms { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-call { background: rgba(251, 146, 60, 0.15); color: #fb923c; }

.event-card.status-sms::before { background: #10b981; }
.event-card.status-call::before { background: #fb923c; }

.sidebar-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent-purple);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-logout:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ==========================================
   MAP CONTAINER & MARKERS
   ========================================== */
#map-container {
    flex-grow: 1;
    height: 100vh;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.pulsing-marker {
    width: 16px;
    height: 16px;
    background-color: var(--accent-cyan);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
    animation: marker-glow 1.5s infinite alternate;
}

@keyframes marker-glow {
    from { box-shadow: 0 0 4px rgba(6, 182, 212, 0.6); }
    to { box-shadow: 0 0 15px rgba(6, 182, 212, 1), 0 0 25px rgba(6, 182, 212, 0.5); }
}

/* ==========================================
   CUSTOM COMPONENT UI SCROLLBARS
   ========================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* ==========================================
   MOBILE & RESPONSIVE LAYOUT STYLES
   ========================================== */
.btn-toggle-sidebar {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1100;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #f8fafc;
    width: 46px;
    height: 46px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-toggle-sidebar:hover {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(99, 102, 241, 0.4);
    transform: scale(1.05);
}

.btn-toggle-sidebar:active {
    transform: scale(0.95);
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 767.98px) {
    .btn-toggle-sidebar {
        display: flex !important;
    }

    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 320px;
        max-width: 85%;
        transform: translateX(0);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    #sidebar.collapsed {
        transform: translateX(-100%) !important;
    }

    #map-container {
        width: 100vw;
        height: 100vh;
    }

    /* Adjust Leaflet zoom controls placement to not collide with sidebar toggle */
    .leaflet-bottom.leaflet-right {
        margin-bottom: 20px;
        margin-right: 10px;
    }
}

