/* =========================================================
   RedRiverLab Premium Glassmorphism Theme (Aggressive)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;600&display=swap');

body {
    background-color: transparent !important;
    color: #f8fafc !important;
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
    -webkit-font-smoothing: antialiased;
}

/* Hide original Nav and Footer */
nav.navbar, footer {
    display: none !important;
}

/* ==========================================
   CARDS & SURFACES (Glassmorphism)
   ========================================== */
.card, .card.text-bg-light {
    background: rgba(15, 23, 42, 0.45) !important;
    border: 1px solid rgba(148, 163, 184, 0.1) !important;
    color: #f8fafc !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3) !important;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.1) !important;
}

.card-header {
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    font-weight: 600 !important;
    color: #38bdf8 !important;
    letter-spacing: 0.5px !important;
    padding: 15px 20px !important;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.card-body {
    padding: 20px !important;
}

/* ==========================================
   BUTTONS (Neon & Cyberpunk Styles)
   ========================================== */
.btn {
    border-radius: 8px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    /* text-transform: uppercase !important; */
    font-size: 0.85rem !important;
    padding: 10px 20px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}

/* Primary Button (Cyan) */
.btn-primary, .btn-outline-primary {
    background: rgba(56, 189, 248, 0.1) !important;
    border: 1px solid rgba(56, 189, 248, 0.5) !important;
    color: #38bdf8 !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.1) !important;
}

.btn-primary:hover, .btn-outline-primary:hover {
    background: rgba(56, 189, 248, 0.25) !important;
    border-color: #38bdf8 !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4), 0 0 40px rgba(56, 189, 248, 0.2) !important;
    transform: translateY(-2px);
}

/* Success Button (Emerald) */
.btn-success, .btn-outline-success {
    background: rgba(16, 185, 129, 0.1) !important;
    border: 1px solid rgba(16, 185, 129, 0.5) !important;
    color: #10b981 !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1) !important;
}

.btn-success:hover, .btn-outline-success:hover {
    background: rgba(16, 185, 129, 0.25) !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4) !important;
    transform: translateY(-2px);
}

/* Danger Button (Rose/Neon Pink) */
.btn-danger, .btn-outline-danger {
    background: rgba(244, 63, 94, 0.1) !important;
    border: 1px solid rgba(244, 63, 94, 0.5) !important;
    color: #f43f5e !important;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.1) !important;
}

.btn-danger:hover, .btn-outline-danger:hover {
    background: rgba(244, 63, 94, 0.25) !important;
    border-color: #f43f5e !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.4) !important;
    transform: translateY(-2px);
}

/* Secondary Button (Muted/Slate) */
.btn-secondary, .btn-outline-secondary {
    background: rgba(148, 163, 184, 0.1) !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
    color: #cbd5e1 !important;
}

.btn-secondary:hover, .btn-outline-secondary:hover {
    background: rgba(148, 163, 184, 0.2) !important;
    border-color: rgba(148, 163, 184, 0.8) !important;
    color: #ffffff !important;
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.3) !important;
    transform: translateY(-2px);
}

/* Connect Button specific styling */
#btnconnect {
    background: rgba(56, 189, 248, 0.15) !important;
    border: 1px solid #38bdf8 !important;
    color: #38bdf8 !important;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3) !important;
    padding: 15px 40px !important;
    font-size: 1.1rem !important;
}
#btnconnect:hover {
    background: rgba(56, 189, 248, 0.3) !important;
    color: #fff !important;
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.6) !important;
}

/* Button Group / Radio Buttons */
.btn-check:checked + .btn {
    background: rgba(56, 189, 248, 0.2) !important;
    border-color: #38bdf8 !important;
    color: #38bdf8 !important;
    box-shadow: inset 0 0 10px rgba(56, 189, 248, 0.2), 0 0 15px rgba(56, 189, 248, 0.4) !important;
}

.btn-group > .btn {
    backdrop-filter: blur(4px);
}

/* Dropdown Menus */
.dropdown-menu {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    backdrop-filter: blur(16px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    border-radius: 12px !important;
    padding: 8px !important;
}

.dropdown-item {
    color: #cbd5e1 !important;
    border-radius: 6px !important;
    transition: all 0.2s !important;
    font-size: 0.9rem !important;
    padding: 8px 16px !important;
}

.dropdown-item:hover {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
}

/* ==========================================
   MODALS
   ========================================== */
.modal-content {
    background: rgba(11, 15, 25, 0.85) !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    color: #f8fafc !important;
    border-radius: 20px !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05) inset !important;
}

.modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 20px 25px !important;
}

.modal-title {
    color: #38bdf8 !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
}

.modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 20px 25px !important;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%) !important;
    opacity: 0.5 !important;
}

.btn-close:hover {
    opacity: 1 !important;
}

/* ==========================================
   TYPOGRAPHY & DATA DISPLAYS
   ========================================== */
.text-muted {
    color: #94a3b8 !important;
}

h1, h2, h3, h4, h5, h6 {
    color: #f8fafc !important;
    font-weight: 600 !important;
}

/* Data blocks (<pre> tags for joystick values) */
pre {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #38bdf8 !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
    font-family: 'Fira Code', monospace !important;
    font-size: 0.9rem !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5) !important;
    margin: 0 !important;
}

/* ==========================================
   TABS
   ========================================== */
.nav-tabs {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    gap: 5px;
}

.nav-tabs .nav-link {
    color: #94a3b8 !important;
    border: 1px solid transparent !important;
    border-radius: 12px 12px 0 0 !important;
    padding: 12px 20px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
}

.nav-tabs .nav-link:hover {
    color: #e2e8f0 !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

.nav-tabs .nav-link.active {
    background: rgba(56, 189, 248, 0.1) !important;
    color: #38bdf8 !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
    border-bottom-color: transparent !important;
    box-shadow: inset 0 3px 0 0 #38bdf8 !important;
}

/* ==========================================
   ALERTS (Glassmorphism)
   ========================================== */
.alert {
    background: rgba(56, 189, 248, 0.1) !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
    color: #38bdf8 !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.alert-info {
    background: rgba(56, 189, 248, 0.1) !important;
    border-color: rgba(56, 189, 248, 0.4) !important;
    color: #7dd3fc !important;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
    color: #fcd34d !important;
}

.alert-danger {
    background: rgba(244, 63, 94, 0.15) !important;
    border-color: rgba(244, 63, 94, 0.5) !important;
    color: #fda4af !important;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #6ee7b7 !important;
}

/* ==========================================
   LIST GROUPS (Modals)
   ========================================== */
.list-group {
    border-radius: 12px !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.list-group-item {
    background: rgba(15, 23, 42, 0.4) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: #cbd5e1 !important;
    padding: 15px 20px !important;
    transition: all 0.2s ease !important;
}

.list-group-item:hover {
    background: rgba(56, 189, 248, 0.05) !important;
    color: #f8fafc !important;
}

.list-group-item.active {
    background: rgba(56, 189, 248, 0.2) !important;
    border-left: 4px solid #38bdf8 !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: #38bdf8 !important;
    font-weight: 600 !important;
}

/* ==========================================
   ACCORDIONS (FAQ)
   ========================================== */
.accordion {
    gap: 10px;
    display: flex;
    flex-direction: column;
}

.accordion-item {
    background: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    overflow: hidden;
}

.accordion-button {
    background: transparent !important;
    color: #f8fafc !important;
    font-weight: 500 !important;
    padding: 18px 20px !important;
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
    background: rgba(56, 189, 248, 0.1) !important;
    color: #38bdf8 !important;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2) !important;
}

.accordion-button::after {
    filter: invert(1) brightness(200%) !important;
}

.accordion-button:not(.collapsed)::after {
    filter: invert(70%) sepia(50%) saturate(4000%) hue-rotate(170deg) brightness(100%) !important;
}

.accordion-body {
    color: #94a3b8 !important;
    padding: 20px !important;
}

/* ==========================================
   INPUTS & FORMS
   ========================================== */
.form-control, .form-select {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f8fafc !important;
    border-radius: 8px !important;
    padding: 10px 15px !important;
    transition: all 0.3s ease !important;
}

.form-control:focus, .form-select:focus {
    background: rgba(0, 0, 0, 0.5) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.25) !important;
    color: #f8fafc !important;
}

.form-check-input {
    background-color: rgba(0, 0, 0, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.form-check-input:checked {
    background-color: #38bdf8 !important;
    border-color: #38bdf8 !important;
}

/* ==========================================
   PROGRESS BARS
   ========================================== */
.progress {
    background-color: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 10px !important;
    height: 12px !important;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #0ea5e9, #38bdf8) !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5) !important;
}

/* ==========================================
   SCROLLBARS
   ========================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* ==========================================
   HARDWARE WRITE LOCK (Safety Features)
   ========================================== */
.hw-locked #savechanges, 
.hw-locked #restore-calibration-btn,
.hw-locked #four-step-center-calib,
.hw-locked #quick-center-calib-group,
.hw-locked #range-calib-group,
.hw-locked #ds5finetune {
    opacity: 0.25 !important;
    pointer-events: none !important;
    filter: grayscale(100%) !important;
    position: relative;
}

.hw-locked #savechanges::after {
    content: " (LOCKED)";
    font-size: 0.8em;
    font-weight: 800;
    color: #f43f5e;
}

/* Fix connection box inside hid-core */
#connect-btn-area {
    background: transparent !important;
    border: none !important;
    padding: 20px 0 !important;
}


/* ==========================================
   CONNECTION HUB (Offline Screen)
   ========================================== */
.connection-hub {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px !important;
    margin: 30px auto;
    max-width: 600px;
    background: rgba(15, 23, 42, 0.4);
    border: 2px dashed rgba(56, 189, 248, 0.3);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    transition: all 0.4s ease;
    text-align: center;
}

.connection-hub:hover {
    border-color: rgba(56, 189, 248, 0.6);
    background: rgba(56, 189, 248, 0.05);
    box-shadow: 0 0 40px rgba(56, 189, 248, 0.1);
}

.hub-icon-container {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
}

.hub-icon-container i {
    font-size: 4rem;
    color: #38bdf8;
    filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.6));
    z-index: 2;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.2);
    animation: pulse 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.hub-title {
    font-size: 1.8rem !important;
    font-weight: 700 !important;
    color: #f8fafc !important;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.hub-desc {
    font-size: 1.1rem;
    color: #94a3b8;
    margin-bottom: 35px;
    line-height: 1.6;
    max-width: 80%;
}

/* Button pulse animation */
.pulse-btn {
    animation: btnPulse 3s infinite;
}

@keyframes btnPulse {
    0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(56, 189, 248, 0); }
    100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}



/* ==========================================
   ACTIVE CONNECTION HUB (Online Screen)
   ========================================== */
.active-connection-hub {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    padding: 20px 25px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.1);
    transition: all 0.3s ease;
}

.active-connection-hub:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.2);
}

.status-indicator.online {
    width: 14px;
    height: 14px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 15px #10b981;
    position: relative;
    flex-shrink: 0;
}

.pulse-glow::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid #10b981;
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Fix Button Group Wrapping */
.btn-group .btn {
    white-space: nowrap !important;
    min-width: min-content;
}
.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}


/* Add top spacing to display mode buttons to prevent sticking */
.btn-group[aria-label="Display mode options"] {
    margin-top: 25px !important;
}
