/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Brand Colors - Primary */
    --primary-blue: #0478CC;
    --light-blue: #4AA6E8;
    --very-light-blue: #D9EBF7;

    /* Brand Colors - Secondary */
    --gray-blue: #8492A6;
    --orange: #FA884C;
    --red: #FD5C65;
    --green: #13CE8B;

    /* Layout */
    --top-bar-height: 70px;
    --sidebar-width: 280px;
    --transition-speed: 0.3s;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    overflow: hidden;
}

/* Top Bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-height);
    background-color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hamburger {
    position: fixed;
    top: 11px;
    left: 0;
    background-color: var(--light-blue);
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 50px;
    height: 48px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    transition: all var(--transition-speed);
    z-index: 1001;
}

.hamburger:hover {
    background-color: var(--light-blue);
}

.hamburger span {
    display: block;
    width: 26px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all var(--transition-speed);
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}


.logo {
    display: flex;
    align-items: center;
    margin-left: 70px;
}

.logo-img {
    height: 40px;
    width: auto;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--top-bar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--top-bar-height));
    background-color: var(--primary-blue);
    transform: translateX(-100%);
    transition: transform var(--transition-speed) ease-in-out;
    z-index: 900;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-content {
    padding: 30px 20px;
    overflow-y: auto;
    height: 100%;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.pin-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.pin-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.pin-button.pinned {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
}

.pin-button.pinned svg {
    transform: rotate(45deg);
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 8px;
}

.nav-link {
    display: block;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 15px;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-link.active {
    background-color: var(--light-blue);
    color: #ffffff;
    font-weight: 500;
}

/* Main Content */
.main-content {
    position: fixed;
    top: var(--top-bar-height);
    left: 0;
    right: 0;
    bottom: 36px;
    background-color: #f5f7fa;
    transition: left var(--transition-speed);
    display: flex;
    flex-direction: column;
}

.main-content.sidebar-open {
    left: var(--sidebar-width);
}

.main-content.sidebar-pinned {
    left: var(--sidebar-width);
}

/* Title Row */
.title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

.dashboard-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 0;
}

.title-row-controls {
    display: none;
    align-items: center;
    gap: 12px;
}

.title-row-controls.visible {
    display: flex;
}

.title-row-controls label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.title-row-controls select {
    padding: 10px 15px;
    font-size: 14px;
    color: #333;
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 280px;
}

.title-row-controls select:hover {
    border-color: var(--light-blue);
}

.title-row-controls select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(4, 120, 204, 0.1);
}

/* Dashboard Frame Container */
.dashboard-frame-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#dashboardFrame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    overflow: hidden;
    /* Prevent GPU compositing issues on Windows/iPad */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
    /* Force CPU rendering instead of GPU */
    will-change: auto;
    contain: layout style paint;
}

#superset-container {
    width: 100%;
    height: 100%;
}

/* Overlay */
.overlay {
    position: fixed;
    top: var(--top-bar-height);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed), visibility var(--transition-speed);
    z-index: 800;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: left var(--transition-speed);
    box-shadow: none;
}

.footer.sidebar-open {
    left: var(--sidebar-width);
}

.footer.sidebar-pinned {
    left: var(--sidebar-width);
}

.footer p {
    margin: 0;
    padding: 8px 0;
    font-size: 11px;
    color: var(--gray-blue);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }

    .logo-text {
        font-size: 16px;
    }
}
