/* ===========================================================================
   CyberSee — Dashboard Layout (Header, Sidebar, Main Content)
   Extracted from admin.css
   =========================================================================== */

/* --- Main Content Area --- */
.main-content {
    margin-left: 55px;
    width: calc(100% - 55px)
}

.main-content.content-expanded {
    margin-left: 320px !important;
    width: calc(100% - 320px) !important
}

.main-content .header h1, .main-content .header-alert h1 {
    font-size: 32px;
    margin-bottom: 10px
}

.main-content .header-alert h1, .title-form {
    margin-bottom: 30px
}

/* --- Dashboard Header --- */
#dashboardHeader.header.fixed-top {
    left: 55px;
    width: calc(100% - 55px);
    z-index: 1050;
    min-height: 60px;
    display: flex;
    align-items: center;
    background: var(--dark-bg, #212121) !important
}

#dashboardHeader.header-expanded {
    left: 320px !important;
    width: calc(100% - 320px) !important
}

body.sidebar-animating #dashboardHeader.header.fixed-top,
body.sidebar-animating .main-content {
    transition: margin-left .28s cubic-bezier(.4, 0, .2, 1),
                left .28s cubic-bezier(.4, 0, .2, 1),
                width .28s cubic-bezier(.4, 0, .2, 1)
}

#dashboardHeader .header-actions {
    white-space: nowrap;
    overflow: visible
}

#dashboardHeader h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 50%
}

body.sidebar-expanded #dashboardHeader.header.fixed-top {
    left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important
}

#dashboardHeader.header.fixed-top {
    left: var(--sidebar-expanded) !important;
    width: calc(100% - var(--sidebar-expanded)) !important;
}

html[data-bs-theme=dark] #dashboardHeader.header.fixed-top,
html[data-bs-theme=dark] .header,
html[data-bs-theme=dark] header {
    background: var(--dark-bg) !important;
    box-shadow: none !important;
    border: none !important
}

html[data-bs-theme=light] .dashboard-header {
    background: #fff
}

/* --- Header --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px
}

.header .notification-bell i {
    color: #fff
}

.header .notification-bell .badge, .sort-icon {
    font-size: .75rem
}

.header .theme-icon, .header .user-icon {
    font-size: 24px;
    padding: 4px
}

.header .user-icon {
    margin-left: 4px
}

.header .header-actions {
    margin-top: 0;
    justify-content: flex-end
}

.time-period {
    font-size: 14px
}

/* --- Glass Header --- */
.glass-header {
    border-bottom: 1px solid rgba(255, 255, 255, .08)
}

/* --- Dashboard Layout --- */
.dashboard {
    display: block;
    min-height: 100%
}

.cards {
    display: flex;
    justify-content: space-between;
    margin-top: 40px
}

.charts {
    margin-top: 20px
}

.card {
    border: .87px solid #fff3;
    color: #fff;
    padding: 15px;
    width: 24%;
    text-align: center
}

.card .header-card, .chart .header-card, .dashboard-card .header-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px
}

.dashboard-card .header-card span {
    font-size: 12px;
    color: inherit
}

.dashboard-card .header-card i {
    color: #0d6efd
}

.card .header-card h2, .chart .header-card h2, .dashboard-card .header-card h2 {
    font-size: 16px;
    margin: 0
}

.card-value .text-val {
    font-size: 24px
}

.card-cahrt {
    padding: 20px 0
}

.card-cahrt .header-card {
    padding: 0 20px
}

.configurations .config-info, .header-alert p {
    margin-bottom: 20px;
    font-size: 14px;
    color: #808389
}

/* --- Dark Cards & Tables --- */
.darck-card {
    background-color: #151a24;
    padding-bottom: 20px
}

.darck-card .header-card h2 {
    font-size: 18px
}

.dark-table {
    width: calc(100% - 40px);
    margin: 0 20px
}

.dark-table td, .dark-table th {
    padding: 16px 24px;
    font-size: 14px;
    text-align: start
}

.custom-card {
    background: #1e1e2d;
    border: 1px solid #2d2d42;
    border-radius: 8px;
    width: 100% !important;
    padding: 0 20px
}

/* --- Head Filter & Tabs --- */
.head-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #c5bcbc;
    padding-bottom: 10px
}

.head-filter .tabs {
    display: flex;
    grid-gap: 20px
}

.tab {
    background: 0 0;
    color: #808389;
    border: none;
    font-size: 16px;
    padding-bottom: 5px;
    cursor: pointer
}

.search {
    width: 25%
}

.search input {
    border: 1px solid rgba(255, 255, 255, .2);
    height: 31px;
    font-size: 14px;
    padding: 10px;
    width: 100%;
    max-width: 320px
}

/* --- Alerts Panel --- */
.alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 20px
}

.alerts .left-alert {
    display: flex;
    flex-direction: column;
    gap: 15px
}

.alert-card {
    border: 1px solid rgba(255, 255, 255, .2)
}

.alerts .right-alert {
    padding: 20px;
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, .2)
}

.alerts .header-card {
    padding: 20px
}

.alerts .header-card h2 {
    font-size: 24px;
    margin-bottom: 5px
}

.alerts .header-card p {
    font-weight: 400;
    color: #fff;
    font-size: 14px
}

.alerts .header-card .lastp {
    text-transform: capitalize;
    margin-top: 20px
}

.alerts .body-alert-card {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-top: 1px solid rgba(255, 255, 255, .2)
}

.alerts .body-alert-card > div {
    padding: 15px
}

.alerts .body-alert-card > div:nth-child(2) {
    border-left: 1px solid rgba(255, 255, 255, .2);
    border-right: 1px solid rgba(255, 255, 255, .2)
}

.alerts .body-alert-card .title-body {
    display: block;
    font-size: 14px;
    margin-bottom: 8px
}

.alerts .right-alert .title-table-en {
    font-size: 24px;
    margin-bottom: 20px
}

/* --- Latest Reports --- */
.latest-reports {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 320px;
    overflow-y: auto
}

.latest-reports li {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    font-size: 14px
}

.latest-reports li:last-child {
    border-bottom: none
}

.latest-reports i {
    font-size: 18px;
    margin-right: 6px
}

.latest-reports li .flex-grow-1 {
    display: flex;
    flex-direction: column
}

/* --- n8n Chat --- */
#n8n-chat {
    max-width: 600px;
    margin: 0 auto
}

/* --- Loading Overlay --- */
.loading-overlay {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 50px 0;
    background: rgba(137, 137, 137, .28);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999
}

.loading-overlay .spinner-border {
    position: relative;
    z-index: 1000
}

.v1 {
    border-left: 1px solid grey;
    overflow-y: hidden;
    height: 100%;
    position: absolute;
    left: 50%;
    margin-left: -3px;
    top: 0
}

/* --- Date Input --- */
.date-input-container {
    position: relative;
    width: 100%;
}

.date-input-container input[type=date] {
    width: 100%;
    color: #fff;
    margin: 0
}

.date-input-container .calendar-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 16px;
    color: #aaa
}

/* --- Sidebar --- */
body.sidebar-animating .sidebar {
    transition: width 0.28s cubic-bezier(.4, 0, .2, 1), background 0.3s;
}

.sidebar.no-transition {
    transition: none !important;
}

.sidebar.expanded {
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

.sidebar-toggle {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: #1c1c1c;
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: flex-start;
    cursor: pointer;
    transition: background .25s;
    padding: 12px 16px;
}

.sidebar-toggle:hover {
    background: #252525;
}

.sidebar-toggle i {
    font-size: 20px;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.sidebar-item {
    margin-bottom: 6px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-item i {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: inherit;
    transition: all 0.3s ease;
}

.arrow-icon {
    margin-left: auto;
    font-size: 14px;
    color: inherit;
    transition: transform 0.3s ease;
}

.sidebar-item.has-submenu.open .arrow-icon {
    transform: rotate(-180deg);
}

.sidebar-item.active a {
    color: white;
}

.submenu-item:hover {
    transform: none;
}

.submenu-item:hover a {
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
}

.sidebar-item:hover .sidebar-item__tooltip,
.sidebar-item__tooltip {
    display: none !important
}

.sidebar-tooltip {
    position: fixed;
    left: 58px;
    background: #2a2a2a;
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity .15s, transform .15s;
    z-index: 1000000;
    white-space: nowrap;
}

.sidebar-tooltip.show {
    opacity: 1;
    transform: translateY(-50%) translateX(2px);
}

html[data-bs-theme=light] .sidebar-tooltip {
    background: #111827 !important;
    color: #fff !important
}

.sidebar-spacer {
    flex: 1 1 auto;
}

.logout-item button {
    color: inherit;
}

/* Sidebar collapsed state */
body.sidebar-collapsed #sidebar .site-name {
    display: none;
    opacity: 0;
    width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

body.sidebar-collapsed #sidebar .logo {
    justify-content: center;
    border-bottom: none;
    margin-bottom: 8px;
}

body.sidebar-collapsed #sidebar .sidebar-item a,
body.sidebar-collapsed #sidebar .sidebar-item button {
    justify-content: center;
    padding: 12px 10px;
}

body.sidebar-collapsed #sidebar .sidebar-item.has-submenu .arrow-icon {
    display: none;
}

body.sidebar-collapsed #sidebar .sidebar-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

body.sidebar-collapsed #sidebar .sidebar-item {
    margin: 6px 0;
}

body.sidebar-collapsed #sidebar .sidebar-item a i,
body.sidebar-collapsed #sidebar .sidebar-item button i {
    font-size: 20px;
}

body.sidebar-collapsed #sidebar > .sidebar-item:hover a,
body.sidebar-collapsed #sidebar .sidebar-item:hover button {
    background: var(--brand-primary-600);
    color: #fff !important;
}

body.sidebar-collapsed #sidebar .logout-item button {
    justify-content: center;
}

#sidebar .sidebar-text {
    display: inline-block !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .sidebar, .submenu {
        transition: none !important
    }
}

/* --- Responsive (Layout) --- */
@media (max-width: 768px) {
    .header {
        flex-flow: column;
        grid-gap: 0;
        align-items: start
    }

    .header h1 {
        margin-left: 0
    }

    .header.fixed-top {
        left: 0
    }

    .cards, .charts {
        flex-flow: column;
        grid-gap: 15px
    }

    .alerts .left-alert, .alerts .right-alert, .card, .chart, .sidebar-item.log-out img {
        width: 100%
    }

    .sidebar-item.log-out {
        width: 35px;
        padding: 0
    }

    .main-content {
        overflow-x: auto;
        padding-top: 100px
    }

    .config-table td, .config-table th {
        padding: 8px
    }

    .config-table th {
        font-size: 14px
    }

    .config-table td {
        font-size: 12px
    }

    .alerts, .profile-forms {
        flex-flow: column
    }

    .main-content .header h1, .main-content .header-alert h1 {
        font-size: 28px;
        margin-bottom: 10px;
        line-height: 1.2
    }
}

@media (min-width: 768px) {
    .alerts .right-alert {
        margin-top: 0
    }
}

@media (max-width: 767px) {
    .alerts .body-alert-card > div:nth-child(2) {
        border-left: none;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, .2);
        border-bottom: 1px solid rgba(255, 255, 255, .2)
    }
}
