* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', Arial, sans-serif;
    --buttons-color: #5b6f8a54;
}

body {
    background-color: #00000050;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    /* Remove backdrop-filter as it can break sticky positioning */

}

html {
    background-image: url("../assets/background.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}


.device {
    width: 320px;
    background-color: #33333300;
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-right: 500px;
    z-index: 100;
}

.svg-background {
    position: absolute;
    width: 330px;
    height: auto;
    z-index: -1;
    transform: translate(-20px, 0);
}

.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 200,
        'GRAD' 0,
        'opsz' 24;
    font-size: 24px;
    /* Preferred icon size */
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;

    /* Support for all WebKit browsers. */
    -webkit-font-smoothing: antialiased;
    /* Support for Safari and Chrome. */
    text-rendering: optimizeLegibility;

    /* Support for Firefox. */
    -moz-osx-font-smoothing: grayscale;

    /* Support for IE. */
    font-feature-settings: 'liga';
}

.arrow {
    font-size: 48px;
    /* Preferred icon size */
    font-variation-settings:
        'FILL' 0,
        'wght' 100,
        'GRAD' 0,
        'opsz' 24;
}

/* Screen Section - Sticky */
.screen-block {
    width: 290px;
    height: 340px;
    position: relative;
}

.screen-container {
    background-color: #1d1d1d00;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    top: 20px;
    z-index: 100;
}

.screen {
    width: 240px;
    height: 320px;
    background-color: #000000;
    border-radius: 5px;
    color: #fff;
    font-size: 18px;
    overflow: hidden;
    padding: 0;
    margin: 60px 0 0 0;
}

.screen iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    /* Disable mouse/touch interaction on the screen content */
    pointer-events: none;
}

/* Reset button in top left corner of screen */
.reset-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 60px;
    height: 30px;
    background-color: #ff4444;
    color: white;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    z-index: 101;
    user-select: none;
    transition: background-color 0.2s;
}

.reset-btn:hover {
    background-color: #ff6666;
}

.reset-btn:active {
    transform: translateY(2px);
}

/* Hardware Navigation Buttons Section */
.hw-nav-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 50px 25px 0;
    height: 40px;
}

.hw-nav-btn {
    flex: 1;
    height: 40px;
    margin: 100px 5px;
    background-color: var(--buttons-color);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
}

.hw-nav-btn:active {
    transform: translateY(2px);
}

.hw-nav-btn.active {
    background-color: rgba(0, 162, 255, 0.3);
    border: 2px solid rgba(0, 162, 255, 0.5);
}

.hw-nav-icon {
    width: 24px;
    height: 24px;
    /* Icons are already in the SVG background, so no need for separate icons */
    display: none;
}

/* Debug visualization for hardware nav buttons */
.hw-nav-btn {
    background-color: rgba(43, 255, 0, 0) !important;
}

.hw-nav-btn:hover {
    background-color: rgba(0, 255, 98, 0.3) !important;
}

.hw-nav-btn.active {
    border: 0px solid rgba(0, 162, 255, 0.5);
}

/* D-Pad Section */
.dpad-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 25px 0;
}

.power-btn,
.lock-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--buttons-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.1s ease;
}


.power-btn:active,
.lock-btn:active {
    transform: translateY(2px);
}

.dpad {
    width: 120px;
    height: 120px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    top: 25px;
}

.dpad-center {
    width: 40px;
    height: 40px;
    background-color: var(--buttons-color);
    border-radius: 50%;
    position: absolute;
    z-index: 2;
}

.dpad-btn {
    position: absolute;
    width: 40px;
    height: 40px;
    background-color: var(--buttons-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.1s ease;
    z-index: 1;
}


.dpad-btn:active {
    transform: translateY(2px);
}

.dpad-up {
    top: 0;
    left: 40px;
    border-radius: 10px 10px 0 0;
}

.dpad-down {
    bottom: 0;
    left: 40px;
    border-radius: 0 0 10px 10px;
}

.dpad-left {
    left: 0;
    top: 40px;
    border-radius: 10px 0 0 10px;
}

.dpad-right {
    right: 0;
    top: 40px;
    border-radius: 0 10px 10px 0;
}

/* Vertical Buttons Section */
.vertical-buttons {
    display: flex;
    justify-content: space-around;
    padding: 20px 30px 0;
}

.vertical-btn-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vertical-btn {
    width: 60px;
    height: 120px;
    background-color: var(--buttons-color);
    border-radius: 35px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0px 0;
    cursor: pointer;
    transition: all 0.1s ease;
}


.vertical-btn:active {
    transform: translateY(2px);
}

.arrow-btn {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 24px;
}

/* Horizontal Buttons Section */
.horizontal-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 5px 0;
}

.horizontal-btn-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0px 25px;
}

.horizontal-btn-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.horizontal-btn {
    width: 130px;
    height: 50px;
    background-color: var(--buttons-color);
    border-radius: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.horizontal-btn:active {
    transform: translateY(2px);
}

.side-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--buttons-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.1s ease;
}

.side-btn:active {
    transform: translateY(2px);
}

/* Bottom Buttons Section */
.bottom-buttons {
    display: flex;
    justify-content: space-around;
    padding: 0 30px;
}

.round-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--buttons-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: normal;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.round-btn:active {
    transform: translateY(2px);
}

/* Active state for buttons */


/* Sticky screen effect */
/* .screen-container.sticky {
    position: fixed;
    top: 20px;
    z-index: 1000;
    transform: translateX(5px) translateY(0px);
    padding: 10px 20px;
} */

/* Add padding to body when screen is sticky to prevent content jump */
/* background-color: var(--buttons-color);
border-radius: 50%;
position: absolute;
z-index: 2;
} */

.dpad-btn {
    position: absolute;
    width: 40px;
    height: 40px;
    background-color: var(--buttons-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.1s ease;
    z-index: 1;
}


.dpad-btn:active {
    transform: translateY(2px);
}

.dpad-up {
    top: 0;
    left: 40px;
    border-radius: 10px 10px 0 0;
}

.dpad-down {
    bottom: 0;
    left: 40px;
    border-radius: 0 0 10px 10px;
}

.dpad-left {
    left: 0;
    top: 40px;
    border-radius: 10px 0 0 10px;
}

.dpad-right {
    right: 0;
    top: 40px;
    border-radius: 0 10px 10px 0;
}

/* Vertical Buttons Section */
.vertical-buttons {
    display: flex;
    justify-content: space-around;
    padding: 20px 30px 0;
}

.vertical-btn-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vertical-btn {
    width: 60px;
    height: 120px;
    background-color: var(--buttons-color);
    border-radius: 35px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0px 0;
    cursor: pointer;
    transition: all 0.1s ease;
}


.vertical-btn:active {
    transform: translateY(2px);
}

.arrow-btn {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 24px;
}

/* Horizontal Buttons Section */
.horizontal-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 5px 0;
}

.horizontal-btn-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0px 25px;
}

.horizontal-btn-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.horizontal-btn {
    width: 130px;
    height: 50px;
    background-color: var(--buttons-color);
    border-radius: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.horizontal-btn:active {
    transform: translateY(2px);
}

.side-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--buttons-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: normal;
    cursor: pointer;
    transition: all 0.1s ease;
}

.side-btn:active {
    transform: translateY(2px);
}

/* Bottom Buttons Section */
.bottom-buttons {
    display: flex;
    justify-content: space-around;
    padding: 0 30px;
}

.round-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--buttons-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-weight: normal;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.round-btn:active {
    transform: translateY(2px);
}

/* Active state for buttons */


/* Sticky screen effect */
/* .screen-container.sticky {
    position: fixed;
    top: 20px;
    z-index: 1000;
    transform: translateX(5px) translateY(0px);
    padding: 10px 20px;
} */

/* Add padding to body when screen is sticky to prevent content jump */
body.sticky-padding {
    padding-top: 20px;
    /* Height of screen + padding */
}

.dpad-center,
.round-btn,
.side-btn,
.horizontal-btn,
.power-btn,
.lock-btn,
.dpad-btn,
.vertical-btn {
    background-color: #00a2ff00;
}

.dpad-center:hover,
.round-btn:hover,
.side-btn:hover,
.horizontal-btn:hover,
.power-btn:hover,
.lock-btn:hover,
.dpad-btn:hover,
.vertical-btn:hover {
    background-color: #00a2ff00;
}

.power-btn.active,
.lock-btn.active,
.dpad-btn.active,
.vertical-btn.active,
.horizontal-btn.active,
.side-btn.active,
.round-btn.active {
    background-color: #0044ff00 !important;
}

.side-btn.left-leg.active,
.side-btn.right-leg.active {
    border: 3px solid #0084ff;
}

.round-btn.side {
    margin: 24px 0 0 0;
}

/* DEBUG: Visualize Mouse Areas */
.power-btn,
.lock-btn,
.dpad-btn,
.side-btn,
.round-btn,
.arrow-btn,
.dpad-center {
    background-color: rgba(43, 255, 0, 0) !important;
}


.power-btn:hover,
.lock-btn:hover,
.dpad-btn:hover,
.side-btn:hover,
.round-btn:hover,
.arrow-btn:hover,
.dpad-center:hover {
    background-color: rgba(0, 255, 98, 0.3) !important;

}

/* Debug Navigation Styles */
.debug-nav {
    position: relative;
    margin-bottom: 15px;
    z-index: 1000;
}

.debug-nav-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: rgba(76, 201, 240, 0.9);
    border-radius: 8px;
    cursor: pointer;
    color: white;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s;
    user-select: none;
}

.debug-nav-header:hover {
    background-color: rgba(76, 201, 240, 1);
}

.debug-nav-title {
    flex: 1;
}

.debug-nav-arrow {
    transition: transform 0.3s;
}

.debug-nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: rgba(40, 40, 40, 0.95);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

.debug-nav.open .debug-nav-dropdown {
    max-height: 500px;
    opacity: 1;
    overflow-y: auto;
    /* Allow scrolling if content exceeds height */
}

.debug-nav.open .debug-nav-arrow {
    transform: rotate(180deg);
}

.debug-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.debug-nav-item:last-child {
    border-bottom: none;
}

.debug-nav-item:hover {
    background-color: rgba(76, 201, 240, 0.3);
    color: white;
}

.debug-nav-item .material-icons {
    font-size: 18px;
    color: #4cc9f0;
}

.debug-nav-item.active {
    background-color: rgba(76, 201, 240, 0.2);
    color: white;
}

.debug-nav-item.active .material-icons {
    color: white;
}

/* External navigation (outside device) */
.external-nav {
    margin-top: 20px;
    width: 320px;
    align-self: center;
}

.external-nav .debug-nav-header {
    background-color: rgba(247, 37, 133, 0.9);
}

.external-nav .debug-nav-header:hover {
    background-color: rgba(247, 37, 133, 1);
}

.external-nav .debug-nav-item .material-icons {
    color: #f72585;
}

.external-nav .debug-nav-item:hover {
    background-color: rgba(247, 37, 133, 0.3);
}

.external-nav .debug-nav-item.active {
    background-color: rgba(247, 37, 133, 0.2);
}

/* Mobile Responsiveness for Debug Nav */
@media (max-width: 768px) {
    .external-nav {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: auto;
        margin-top: 0;
        z-index: 2000;
    }

    .external-nav .debug-nav-header {
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }

    .external-nav .debug-nav-title,
    .external-nav .debug-nav-arrow {
        display: none;
    }

    .external-nav .debug-nav-header .material-icons {
        margin: 0;
    }

    .external-nav .debug-nav-dropdown {
        bottom: calc(100% + 10px);
        top: auto;
        right: 0;
        left: auto;
        width: 250px;
        border-radius: 8px;
        transform-origin: bottom right;
    }
}

/* Hidden side buttons for surgical table controller */
.hidden-side-buttons {
    position: absolute;
    left: 350px; /* 320px device width + 15px padding + 15px offset */
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 10;
}

.hidden-side-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--buttons-color);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.hidden-side-btn:active {
    transform: translateY(2px) scale(0.95);
}

.hidden-side-btn:hover {
    background-color: rgba(91, 111, 138, 0.8);
}

.hidden-side-btn::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 2px;
    background-color: #fff;
    opacity: 0.7;
}

.hidden-side-btn::after {
    content: '';
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 8px solid #fff;
    opacity: 0.7;
}

.hidden-side-btn .arrow-icon {
    font-size: 24px;
    font-weight: bold;
}

.hidden-side-btn.up .arrow-icon::before {
    content: '▲';
}

.hidden-side-btn.down .arrow-icon::before {
    content: '▼';
}