@font-face {
    font-family: 'Aktiv Grotesk';
    src: url('./fonts/aktivgrotesk-bolditalic-webfont.woff2') format('woff2'),
        url('./fonts/aktivgrotesk-bolditalic-webfont.woff') format('woff');
    font-weight: bold;
    font-style: italic;

}

@font-face {
    font-family: 'Aktiv Grotesk';
    src: url('./fonts/aktivgrotesk-bold-webfont.woff2') format('woff2'),
        url('./fonts/aktivgrotesk-bold-webfont.woff') format('woff');
    font-weight: bold;
    font-style: normal;

}

@font-face {
    font-family: 'Aktiv Grotesk';
    src: url('./fonts/aktivgrotesk-light-webfont.woff2') format('woff2'),
        url('./fonts/aktivgrotesk-light-webfont.woff') format('woff');
    font-weight: lighter;
    font-style: normal;

}

@font-face {
    font-family: 'Aktiv Grotesk';
    src: url('./fonts/aktivgrotesk-mediumitalic-webfont.woff2') format('woff2'),
        url('./fonts/aktivgrotesk-mediumitalic-webfont.woff') format('woff');
    font-weight: 500;
    font-style: italic;

}

@font-face {
    font-family: 'Aktiv Grotesk';
    src: url('./fonts/aktivgrotesk-medium-webfont.woff2') format('woff2'),
        url('./fonts/aktivgrotesk-medium-webfont.woff') format('woff');
    font-weight: 500;
    font-style: normal;

}

@font-face {
    font-family: 'Aktiv Grotesk';
    src: url('./fonts/aktivgrotesk-regular-webfont.woff2') format('woff2'),
        url('./fonts/aktivgrotesk-regular-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;

}

@font-face {
    font-family: 'Aktiv Grotesk';
    src: url('./fonts/aktivgrotesk-italic-webfont.woff2') format('woff2'),
        url('./fonts/aktivgrotesk-italic-webfont.woff') format('woff');
    font-weight: normal;
    font-style: italic;

}

html {
    font-family: 'Aktiv Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Aktiv Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: normal;
    color: #58595B;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh;
    /* Uses dynamic viewport height */
    overflow: hidden;
    background: #F2E9E4;
    position: fixed;
    width: 100%;
    font-family: 'Aktiv Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

div#clients-list {
    position: absolute;
    width: 100vw;
    height: 100vh;
    background: #F2E9E4;
    z-index: 9990;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 40px 20px;
    align-content: flex-start;
    justify-content: center;
    overflow-y: auto;
    flex-direction: column;
}

#client-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 0 20px 40px;
    /* Adjust padding to fit the new structure */
    align-content: flex-start;
    justify-content: center;
    overflow-y: auto;
    flex-grow: 1;
    /* Allows this container to fill the remaining space */
}

.client-card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    min-width: 310px;
    min-height: 150px;
    transition: transform 0.3s ease;
    box-shadow: 8px 8px 56px #DACFC38F;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
    /* overflow: hidden; */
}

.line {
    width: 100%;
    height: 1px;
    border: none;
    background: #EBE2DC;
}

.device-icon {
    background: #58595B;
    padding: 14px 17px;
    border-radius: 50%;
    margin-bottom: 15px;
    color: #58595B;
}

.card-footer {
    width: 100%;
    padding-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 0.9rem;
    color: #58595B;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    margin-right: 5px;
    animation: pulse 1.5s infinite;
}

.click-hint {
    margin-top: 1px;
    font-size: 0.8rem;
    color: #58595B;
    text-align: center;
}

.device-location {
    color: #58595B;
}

/* No Device Connected */
.status-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #f44336;
    margin-right: 10px;
    animation: pulse 1.5s infinite;
}

.status-div {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    background-color: #E4D8D2;
    padding: 1rem;
    border-radius: 56px;
    gap: 10px;
    font-size: 14px;
    min-width: 279px;
    justify-content: center;
}

.device-info {
    text-align: center;
    padding-top: 10px;
    padding-bottom: 10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-name {
    color: #58595B
}

.device-info .status-text {
    color: #58595B;
    font-size: 14px;
    margin: 0;
}

.device-status {
    color: #58595B;
    font-size: 14px;
    margin: 0;
    text-align: center;
    width: 100%;
}


.verification-input {
    background: #F2E9E4;
    border: 1px solid #444;
    color: #58595B;
    padding: 10px;
    margin: 10px 0 0;
    border-radius: 8px;
    font-size: 1.2rem;
    width: 120px;
    text-align: center;
    width: 100%;
}

.verification-input:focus {
    border-color: #0088ff;
    outline: none;
}

/* Container setup */
#container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: -webkit-fill-available;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #F2E9E4;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    align-items: center;
    justify-content: center;
}

#floorplan-container img {
    max-width: 100%;
    max-height: calc(100% - env(safe-area-inset-bottom, 0px));
    object-fit: contain;
    background-color: transparent;
}

/* Floor plan container */
#floorplan-container {
    position: relative;
    width: 100%;
    /*flex: 1;*/
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Add specific padding for the bottom safe area */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    /* Ensure the container has a minimum height */
    min-height: 0;
}


#floorplan {
    position: absolute;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    /* Center the images */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* FAB Menu Styles */
.fab-container {
    position: fixed;
    right: 20px;
    /* transform: translateX(-50%); */
    /* Moved more to the left */
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    z-index: 999;
}

.fab-option {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #F2E9E4;
    border: none;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.btn:hover,
.fab-option:hover {
    transform: scale(1.1);
}

.btn-rounded {
    font-weight: bold;
    border-radius: 32px;
    padding: 13px 15px;
    font-size: 14px;
}

.btn-primary {
    background-color: #F6921E;
    color: white;
}

.btn-secondary {
    background-color: #F2E9E4;
    color: #58595B;
}

.btn-danger {
    background-color: #F6341E;
    color: #fff;
}


.fab-option.active {
    background: #2196F3;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* Player marker */
.player-marker-multi {
    position: absolute;
    width: 200px;
    height: 200px;
    transform: translate(50%, 50%) rotate(0deg);
    transition: all 0.3s ease-out;
    z-index: 10;
    pointer-events: none;
}

/* Safe area adjustments for mobile */
@supports (padding: max(0px)) {
    .fab-container {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
        padding-left: max(0px, env(safe-area-inset-left));
    }
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #2196F3;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .player-marker-multi {
        width: 150px;
        height: 150px;
    }

    .fab-option {
        width: 38px;
        /* Smaller option buttons */
        height: 38px;
        font-size: 16px;
        /* Smaller icon size */
    }
}

@media screen and (max-width: 768px) {
    #container {
        /* Use dvh for dynamic viewport height support */
        height: 100dvh;
    }

    #floorplan-container {
        /* Remove any margin/padding that might affect sizing */
        margin: 0;
        /* Only keep the necessary bottom padding for safe area */
        padding: 0 0 env(safe-area-inset-bottom, 0px) 0;
    }

    #floorplan {
        /* Ensure images don't exceed container bounds */
        max-height: calc(100% - env(safe-area-inset-bottom, 0px));
    }
}

@media screen and (max-width: 500px) {
    div#clients-list {
        padding: 40px 0px;
    }

    #client-cards-container {
        padding: 0 0px 40px;
    }
}

/* Add specific Chrome fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {

    #floorplan {
        /* Ensure images maintain aspect ratio in Chrome */
        object-fit: contain;
        max-height: calc(100% - env(safe-area-inset-bottom, 0px));
    }
}

/* Teleport spots container */
#teleport-spots {
    pointer-events: none;
    z-index: 20;
}

/* Individual teleport spot */
.teleport-spot {
    position: absolute;
    width: 28px;
    height: 28px;
    transform: translate(-50%, -100%);
    cursor: pointer;
    pointer-events: all;
    animation: pulseMarker 1.5s ease-in-out infinite;
}

.teleport-spot:hover::before {
    background: #66BB6A;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

@keyframes pulseMarker {
    0% {
        transform: translate(-50%, -100%) scale(1);
    }

    50% {
        transform: translate(-50%, -100%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -100%) scale(1);
    }
}

.connections-header {
    width: 100%;
    text-align: center;
    margin-bottom: 30px;
    /* color: #fff; */
    padding: 0 20px;
}

.connections-subtitle {
    font-size: 1.4rem;
    margin-bottom: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.5px;
    /* Slightly tighter letter spacing */
}

.connection-count {
    background: rgba(0, 136, 255, 0.2);
    color: #0088ff;
    padding: 2px 12px;
    /* Slightly more horizontal padding */
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    /* Inherit from parent */
}

/* Add a new class for the logo container to ensure proper spacing */
.logo-container {
    margin-bottom: 20px;
    /* Increased spacing between logo and title */
}


.logo-container img {
    max-width: 200px;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-text {
    color: #ffffff;
    font-size: 16px;
    letter-spacing: 1px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Notification Bar */
.notification-bar {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-weight: 500;
    backdrop-filter: blur(8px);
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    min-width: 200px;
    background: #F6931E;
    background: linear-gradient(90deg, rgba(246, 147, 30, 1) 0%, rgba(252, 185, 19, 1) 100%);
}

.notification-bar.show {
    top: 20px;
}

.notification-bar i {
    font-size: 16px;
}

.notification-bar span {
    font-size: 14px;
    letter-spacing: 0.2px;
}

/* Style for the selected marker and its label */
.player-marker-multi.selected {
    transform: translate(50%, 50%) scale(1.3);
    filter: drop-shadow(0 0 10px #00c6ff);
    /* border: 3px solid #00c6ff;
    border-radius: 50%;
    box-shadow: 0 0 15px #00c6ff; */
}

.marker-label.selected {
    font-weight: bold;
    color: #00c6ff;
    text-shadow: 0 0 5px #58595B;
}

/* Style for the marker label */
.marker-label {
    position: absolute;
    background-color: #58595B;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    transform: translate(50%, 180%);
    /* Position above the marker */
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease-out;
}


/* Style for the edit name icon in the client list */
.edit-name-icon {
    margin-left: auto;
    cursor: pointer;
    color: #aaa;
}

.card-footer i {
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s ease-in-out;
}

/* UX Improvments: Inline Pairing */
.client-card.is-pairing .device-info .verification-input {
    margin-top: 0;
    margin-bottom: 10px;
}

.pairing-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

/* .pair-btn {
    flex-grow: 1;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
} */


/* UX Improvments: Level Selection View */
.level-selection-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: max-content;
    background: #fff;
    display: flex;
    flex-direction: column;
    padding: 30px 15px;
    z-index: 2;
    ;
    border-radius: 15px;
    box-shadow: 8px 8px 56px #DACFC38F;
}


.level-selection-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.level-selection-header span {
    margin-right: 25px;
    flex-grow: 1;
    text-align: center;
    font-weight: 500;
}

.back-btn {
    background: none;
    border: none;
    color: #aaa;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.back-btn:hover {
    color: white;
}

.level-selection-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: max-content;
}

.level-btn {
    width: 100%;
    padding: 10px;
    background: #F2E9E4;
    border-radius: 36px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    font-size: 16px;
    min-height: 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 20px;
    padding-right: 20px;
}

.level-btn:hover {
    transform: scale(1.03);
}


/* 1. Style for the current level display */
.device-level {
    color: #0ECD00;
    margin-right: auto;
    font-weight: 500;
}

/* 3. Style for inline unpairing confirmation */
.unpair-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #58595B;
    width: 100%;
    font-size: 16px;
    background: #F2E9E4;
    border-radius: 36px;
    height: 58px;
    padding-left: 25px;
    padding-right: 6px;
}

.unpair-buttons {
    display: flex;
    gap: 5px;
}

#main-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.85);
    /* Dark, semi-transparent */
    z-index: 1500;
    /* Above floorplan, below client list */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    backdrop-filter: blur(5px);
}

#main-loading-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

#main-loading-overlay .loading-text {
    margin-top: 20px;
    font-size: 1.1rem;
    color: #ccc;
}

#spectator-info-bar {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 998;
    background: white;
    border-radius: 56px;
    box-shadow: 8px 8px 56px #CDCDCD;
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: space-evenly;
    transition: opacity 0.3s ease, transform 0.3s ease;
    min-width: 235px;
    min-height: 58px;
}

#spectator-info-bar.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

#spectator-info-text {
    font-size: 1rem;
    font-weight: 500;
    line-height: 58px;
    white-space: nowrap;
}

.spectator-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Make buttons in the info bar slightly smaller */
@keyframes shake {

    10%,
    90% {
        transform: translateX(-1px);
    }

    20%,
    80% {
        transform: translateX(2px);
    }

    30%,
    50%,
    70% {
        transform: translateX(-4px);
    }

    40%,
    60% {
        transform: translateX(4px);
    }
}

.pair-btn.confirm:disabled {
    background: #0066cc;
    cursor: wait;
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

/* 1. Adjust the connections subtitle to align the new button */
.connections-subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    /* Increased gap to space out elements */
}

/* 2. Style the new refresh button */
.manual-refresh-button {
    background: none;
    border: none;
    color: #aaa;
    /* Subtle color */
    font-size: 1.1rem;
    /* Slightly larger than text for a good tap target */
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    /* Ensures icon is centered vertically */
    transition: color 0.2s ease, transform 0.3s ease;
}

.manual-refresh-button:hover {
    color: #fff;
    /* Brighten on hover */
    transform: scale(1.1);
}

/* 3. Style for the spinning animation */
.manual-refresh-button.is-refreshing i {
    animation: spin 1s linear infinite;
}

/* 4. Disable pointer events while refreshing to prevent spam clicks */
.manual-refresh-button.is-refreshing {
    pointer-events: none;
    color: #0088ff;
    /* Give it a highlight color while active */
}