/* 1. Global Styles */

:root {
    --sat: env(safe-area-inset-top, 0px);
    --sar: env(safe-area-inset-right, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --dbg: #2c3136;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: none;
    touch-action: manipulation;
}

body {
    margin: 0;
    padding: 0;
    position: relative;
    border: 0;
    outline: 0;
    background: 0 0;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    overflow-y: scroll;
    overscroll-behavior: none;
}

#content {
    position: relative;
}

/* 2. Centering Elements */
.center-block {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.centered {
    text-align: center;
}

/* 3. Canvas Styles */
canvas {
    padding: 0px;
    margin: 0px;
    -moz-user-select: none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    user-select: none;
    outline: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* 4. UI Slider Range */
.ui-slider-range {
    background: rgba(38,201,255,0.7);
}

/* 5. Headings */
h3 {
    padding-inline-start: 10px;
}

/* 6. Scrollable Div */
.scrollDiv {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 10px;
}

/* 7. Agent Table */
.agentTable tr td:last-child {
    width: 1%;
    white-space: nowrap;
}

/* 8. Render Engine */
.renderEngine {
    border: solid 1px #ccc;
}

/* 9. Modal Open Body */
body.modal-open {
    overflow: hidden;
}

/* 10. ScrollDiv Buttons */
.scrollDiv div button {
    margin: 1px;
    padding: 4px;
}

/* 11. Alert Container */
#alertcontainer {
    visibility: hidden;
    margin: auto;
    text-align: center;
    border-radius: 4px;
    position: fixed;
    z-index: 2;
    top: calc(50% - 50px);
    inset-inline-start: 0;
    inset-inline-end: 0;
    width: 300px;
    content-visibility: auto;
}

    #alertcontainer.show {
        visibility: visible;
        -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
        animation: fadein 0.5s, fadeout 0.5s 2.5s;
    }

/* 12. Active Dropdown Items */
.active .dropdown-item {
    color: #16181b;
    text-decoration: none;
    background-color: #f8f9fa;
}

/* 13. Word Break */
.wordbreak {
    word-break: break-word;
}

/* 14. Font Awesome Size Adjustments */
.fa-xs {
    font-size: .75em !important;
}

.fa-sm {
    font-size: .875em !important;
}








/* Top bar styling */
#navTop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--dbg); /* Bootstrap dark */
    color: white;
    padding: 0.5rem 1rem;
    height: 50px; /* Set fixed height for top bar */
}

/* Icon panel styling */
.iconPanel {
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    background-color: var(--dbg);
}



/* Icon items styling */

.iconItem {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    padding: 5px 5px;
    cursor: pointer;
    border-radius: 4px;
    margin: 3px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}



.iconItem.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.iconItem i {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.iconItem span {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Mobile optimization tweaks */

/* Start with larger breakpoints and work down */
/* Larger screens (12 icons per row) */
@media (min-width: 1400px) {
    .iconPanel .col-6.col-sm-4.col-md-3.col-lg-2.col-xl-auto {
        width: 8.333333% !important; /* Show 12 icons per row */
        max-width: 8.333333% !important;
        flex: 0 0 8.333333% !important;
        padding-right: 5px !important;
        padding-left: 5px !important;
    }
}

/* Tablet and small desktop (8 icons per row) */
@media (min-width: 768px) and (max-width: 1399px) {
    .iconPanel .col-6.col-sm-4.col-md-3.col-lg-2.col-xl-auto {
        width: 12.5% !important; /* Show 8 icons per row */
        max-width: 12.5% !important;
        flex: 0 0 12.5% !important;
        padding-right: 5px !important;
        padding-left: 5px !important;
    }
}

/* Medium screens (6 icons per row) */
@media (max-width: 767px) {
    .iconPanel .col-6.col-sm-4.col-md-3.col-lg-2.col-xl-auto {
        width: 16.666667% !important; /* Show 6 icons per row */
        max-width: 16.666667% !important;
        flex: 0 0 16.666667% !important;
    }
    .iconItem span {
        font-size: 0.75rem; /* Hide text on smaller screens */
    }
}

/* Small screens (5 icons per row) */
@media (max-width: 600px) {
    .iconPanel .col-6.col-sm-4.col-md-3.col-lg-2.col-xl-auto {
        width: 20% !important; /* Show 5 icons per row */
        max-width: 20% !important;
        flex: 0 0 20% !important;
    }
    .iconItem span {
        font-size: 0.7rem; /* Hide text on smaller screens */
    }
}

/* Smaller screens (4 icons per row) */
@media (max-width: 450px) {
    .iconPanel .col-6.col-sm-4.col-md-3.col-lg-2.col-xl-auto {
        width: 25% !important; /* Show 4 icons per row */
        max-width: 25% !important;
        flex: 0 0 25% !important;
    }
    .iconItem span {
        font-size: 0.65rem; /* Hide text on smaller screens */
    }
}

/* Very small screens (3 icons per row) */
@media (max-width: 400px) {
    .iconPanel .col-6.col-sm-4.col-md-3.col-lg-2.col-xl-auto {
        width: 33.33% !important; /* Show 3 icons per row on very small screens */
        max-width: 33.33% !important;
        flex: 0 0 33.33% !important;
    }
    .iconItem span {
        font-size: 0.6rem; /* Hide text on smaller screens */
    }
}



/* Left, center, right sections of top bar */
.nav-left, .nav-center, .nav-right {
    display: flex;
    align-items: center;
}

.nav-left {
    justify-content: flex-start;
    flex: 1;
}

.nav-center {
    justify-content: center;
    flex: 1;
}

.nav-right {
    justify-content: flex-end;
    flex: 1;
}

#alerts-content {
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 0;
    max-height: 80vh;
    padding: 0;
    background-color: var(--dbg);
}

#sidebar {
    position: fixed;
    z-index: 900;
    opacity: 0;
    transition: transform 0.3s ease-in-out, opacity 0.2s linear;
    height: auto;
    content-visibility: auto;
    transform: translateY(-10px);
}

#sidebar.active {
    margin-inline-start: 0px;
    opacity: 1;
    visibility: visible;
    transform: translateY(50px);
    transition: transform 0.3s ease-in-out, opacity 0.2s linear;
}

/* Enhanced Alerts Styles - Matched with Nav Theme */
.alerts-card {
    border-radius: 0; /* Removed rounded corners */
    overflow: hidden;
    border:0px;
}

.alerts-header {
    background-color: #2C2C2C !important;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1rem;
    color: #ccc !important;
    border: 0px !important;
}

/* Alert Item Styling */
.alert-item {
    display: flex;
    padding: 10px;
    position: relative;
    cursor: pointer;
}

.alert-item:hover {
    background-color: rgba(255, 255, 255, 0.1); 
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-image-container {
    width: 40%;
    height: 68px;
    margin-inline-end: 12px;
    border-radius: var(--bs-border-radius-sm);
    overflow: hidden;
    background-color: var(--dbg);
}

.alert-details {
    flex: 1;
    min-width: 0;
}

.alert-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ccc; /* Added to match nav text color */
}

    .alert-title i {
        margin-inline-end: 5px;
        font-size: 1rem;
    }

.alert-meta {
    font-size: 0.8rem; 
    color: #ccc; 
}

.alert-actions {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    display: flex;
    gap: 8px;
}

.alert-actions i {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.75);
    transition: color 0.15s ease;
    font-size: 1rem;
}



.fa-circle.unread {
    color: var(--bs-primary);
}

/* Header Buttons */
.header-buttons {
    display: flex;
    gap: 6px;
    margin-inline-start: auto;
}

.header-buttons i {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s ease;
}



.header-buttons i.text-warning {
    color: var(--bs-warning);
}

/* Tags styling */
.alert-tag {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 1px 6px;
    border-radius: 0;
    font-size: 0.8rem;
    margin-top: 2px;
    margin-inline-start: 4px;
}
#badgeAlertCount.hidden {
    display: none;
}
/* 18. Cursor Styles */
.nav-link, .dropdown-item {
    cursor: pointer;
}

.viewoption {
    cursor: pointer;
    padding: 5px;
}

/* 19. Editor Padding */
#editor {
    padding-inline-start: 0 !important;
    content-visibility: auto;
}

/* 20. Fix Width */
.fixwidth {
    width: 1em !important;
}

/* 21. Dropdown Menu */
.dropdown-menu {
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    font-size: 1rem !important; /* Moved up from bottom */
}

/* 22. Alert Image */
.alertimage {
    margin-inline-end: 10px;
    float: inline-start;
}

/* 24. Connected Sortable */
.connectedSortable {
    background-color: #666666;
    cursor: pointer;
}

/* 25. View Preview */
.view-preview {
    display: flex !important;
    align-items: center;
    overflow: hidden;
}

    .view-preview img {
        display: inline-block;
        vertical-align: middle;
        margin-inline-end: 10px;
    }

    .view-preview span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.menu-border-right {
    border-inline-end: 2px solid;
    color: #666666;
    padding-inline-end: 10px;
    margin-inline-end: 10px;
}

/* 27. Nav Playback */
#navPlayback {
    position: absolute;
    opacity: 0.6;
}

/* 28. Unselectable Elements */
.unselectable {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 29. Toast Positioning */
@keyframes bounceDown {
    0% {
        top: -100px;
        opacity: 0;
        transform: translateX(-50%) scale(0.3);
    }

    50% {
        opacity: 1;
    }

    65% {
        top: 50px;
        transform: translateX(-50%) scale(1.05);
    }

    80% {
        top: 35px;
        transform: translateX(-50%) scale(0.95);
    }

    95% {
        top: 42px;
        transform: translateX(-50%) scale(1.02);
    }

    100% {
        top: 40px;
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

#toast {
    position: absolute;
    left: 50%;
    top: -100px;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

    #toast.show {
        animation: bounceDown 0.6s ease forwards;
        top: calc(var(--sat) + 40px); /* Final position */
        opacity: 1;
    }

#uiButton {
    color: #fff;
    background-color: rgba(52, 58, 64, 0.7);
}
/* 30. Navbar Item Margins */
.nav-item {
    margin-inline-start: 0px !important;
    margin-inline-end: 0px !important;
}

/* 31. Live Control Icon */
.live-control::before {
    content: '\e0b7';
    font-family: "Font Awesome 6 Pro";
    font-weight: 900;
    margin-inline-end: 5px;
    color: #ffc107;
}

[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .center-block {
    margin-inline-start: auto;
    margin-inline-end: auto;
}

[dir="rtl"] .menu-border-right {
    border-inline-end: 2px solid;
    padding-inline-end: 10px;
    margin-inline-end: 10px;
}

[dir="rtl"] .view-preview img {
    margin-inline-end: 10px; /* Maintains spacing in RTL */
}

[dir="rtl"] .alertimage {
    float: right; 
}


#navToggle {
    position: fixed;
    top: var(--sat);
    inset-inline-start: 50%;
    transform: translateX(-50%);
    background-color: rgba(52, 58, 64);
    color: white;
    border: none;
    padding: 5px 20px;
    cursor: pointer;
    z-index: 1050;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    border: solid 1px #666;
}
[dir="rtl"] #navToggle {
    transform: translateX(50%);
}


#navWrapper.visible #navControls .iconItem {
    opacity: 1;
    transform: translateY(0);
}


#navWrapper {
    position: fixed;
    inset-inline-start: var(--sal);
    inset-inline-end: var(--sar);
    bottom: var(--sab);
    z-index: 1000;
    pointer-events: none;
    opacity: 0.8;
}
#navWrapper.hidden #tabControls {
    display: none;
}
/* Tabs: always visible, animate up when panel is visible */
#tabControls {
    position: absolute;
    z-index: 1050;
    pointer-events: auto;
    display: flex;
    gap: 5px;
    bottom: 0;
    inset-inline-start: 0;
    margin-inline-start: 10px;
    transition: bottom 0.3s ease-in-out; /* Animate bottom instead of transform */
    opacity: 1;
}


#navWrapper.visible #tabControls {
    bottom: 100%; /* Move to top of the panel */
    opacity: 1;
}

/* Slide-up content */
#navControls {
    position: relative;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    background: #333;
    opacity: 1;
    min-height: 50px;
    border-top: solid 1px #666;
}

.navControl {
    background-color: var(--dbg);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    z-index: 1050;
    opacity: 1;
    transition: opacity 0.2s ease;
    border: solid 1px #666;
    border-bottom: none;
}

.navControl.active {
    z-index: 1051;
    position: relative;
    top: 1px;
}

/* When visible, both panel and tabs move up */
#navWrapper.visible #navControls {
    transform: translateY(0);
}


#navWrapper.visible #navControls .iconItem {
    transform: translateY(0);
}

#tabControls, #navWrapper.visible #navControls {
    pointer-events: auto;
}

/* Navigation system container */
#navSystem {
    position: fixed;
    left: var(--sal);
    right: var(--sar);
    z-index: 1000;
    box-shadow: 0px 2px 10px rgba(0,0,0,0.2);
    transition: top 0.3s ease-in-out;
    top: var(--sat);
    transform: translateY(calc(-100% - var(--sab)));
    transition: transform 0.3s ease-in-out;
    visibility: visible;
}

#navSystem.visible {
    transform: translateY(0); 
}

#navSystem.visible .iconItem {
    opacity: 1;
    transform: translateY(0);
}

[dir="rtl"] #tabControls.hidden {
    transform: translateX(calc(100% + var(--sal)));
}

#mainControls {
    position: fixed;
    top: var(--sat);
    inset-inline-start: var(--sal);
    padding: 5px 5px;
    cursor: pointer;
    display: inline-block;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
    z-index: 990;
    opacity: 0.7;
}
#mainControls2 {
    position: fixed;
    top: var(--sat);
    inset-inline-end: var(--sar);
    padding: 5px 5px;
    cursor: pointer;
    display: inline-block;
    transform: translateX(0);
    transition: transform 0.3s ease-in-out;
    z-index: 990;
    opacity: 0.7;
}

#mainControls.hidden {
    transform: translateX(calc(-48% - var(--sal)));
    opacity: 0.4;
}

[dir="rtl"] #mainControls.hidden {
    transform: translateX(calc(50% + var(--sar)));
}

#mainControls2.hidden {
    transform: translateX(calc(100% + var(--sar)));
}

[dir="rtl"] #mainControls2.hidden {
    transform: translateX(calc(-100% - var(--sal)));
}


@media (hover: hover) and (pointer: fine) {
    .btnPlaybackControl:hover {
        opacity: 0.9 !important;
    }

    #navToggle:hover {
        background-color: rgba(52, 58, 64, 1);
        opacity: 1 !important;
    }

    .header-buttons i:hover {
        color: var(--bs-body-color);
    }

    .alert-actions i:hover {
        color: var(--bs-body-color);
    }

    .iconItem:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    #tabControls:hover {
        opacity: 1;
    }

    #mainControls:hover, #mainControls2:hover {
        opacity: 1;
    }

    #mainControls.hidden:hover,
    #mainControls2.hidden:hover {
        opacity: 1;
    }
    #uiButton:hover {
        color: #fff;
        background-color: rgba(52, 58, 64, 1);
    }
}

.notification-dot {
    position: absolute;
    top: 5px;
    inset-inline-end: calc(5px + env(safe-area-inset-right, 0));
    font-size: 0.65rem;
    font-weight: 600;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
}


/* 15. Wrapper Flexbox */
.wrapper {
    display: flex;
    width: 100%;
    height: 100%; /* Use 100% instead of 100vh */
    align-items: stretch;
    padding-left: var(--sal);
    padding-right: var(--sar);
    padding-top: var(--sat);
    padding-bottom: var(--sab);
    box-sizing: border-box; /* Include padding in the element's total width and height */
}

#mainApp {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
}
.toastMessage {
    background-color: var(--dbg);
    color: #fff;
    padding: 5px;
    margin: 0px;
    cursor: pointer;
    border-radius:0px;
}
.toastMessage.error {
    border-inline-start: 5px solid #B20000;
}

.btnPlaybackControl {
    background-color: var(--dbg) !important;
    border-color: #fff !important;
    color: #fff !important;
    opacity: 0.7 !important;
    padding: 8px !important;
    margin-inline-end: 3px !important;
}

.btn {
    text-align:start !important;
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(-10deg);
    }

    30% {
        transform: rotate(10deg);
    }

    45% {
        transform: rotate(-9deg);
    }

    60% {
        transform: rotate(9deg);
    }

    75% {
        transform: rotate(-7deg);
    }

    90% {
        transform: rotate(7deg);
    }
}

.animate {
    animation: wiggle 2s ease-in-out infinite;
}