html, body {
    height: 100%; /* Ensure full height */
    margin: 0; /* Remove default body margins */
    overflow: hidden; /* Prevent overall scrolling */
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #f5f7fa;
}

body {
    background-image: none;
    background-color: #f5f7fa;
}

.container {
    display: flex;
    flex-direction: column;
    height: calc(100% - 50px); /* Subtract header height */
    margin-top: 50px; /* Add margin for header */
    gap: 8px;
    padding: 8px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px; /* Restored horizontal padding */
    background: url('./static/background.png') no-repeat center center;
    background-size: cover;
    border-bottom: 1px solid #e1e4e8;
    height: 50px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Debug styles */
    min-height: 50px;
    overflow: visible;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    order: 1;
    position: relative;
    z-index: 1001;
    overflow: visible;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    order: 3;
    position: relative;
    z-index: 2;
}

.app-title {
    flex-grow: 1;
    text-align: center;
    font-size: 1.5em;
    font-weight: 600;
    color: #ffffff;
    margin: 0 20px;
    order: 2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7), 
                 -1px -1px 0 #c1dff8,  
                 1px -1px 0 #085492,
                 -1px 1px 0 #a8d8ff,
                 1px 1px 0 #a8d8ff; /* Changed to light blue contour */
    position: relative;
    z-index: 2;
    font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
}

.logo-placeholder {
    width: 200px; /* Set fixed width to 200px */
    min-width: 200px; /* Match the width */
    height: 46px; /* Adjusted from 50px to 46px */
    background-image: url('./static/logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 8px;
    position: relative;
    z-index: 2;
    padding: 4px; /* Increased padding from 2px to 4px */
    margin: 0; /* Added to ensure no margin */
    color: transparent; /* Hide any text */
    font-weight: normal; /* Reset font weight */
    font-size: 0; /* Hide any text */
    text-align: center;
    line-height: 0; /* Hide any text */
}

.main-menu {
    position: relative;
    z-index: 1001;
    overflow: visible;
}

.menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 20px;
    overflow: visible;
}

.menu-item {
    position: relative;
    overflow: visible;
}

.menu-trigger {
    padding: 6px 12px;
    background-color: rgba(74, 144, 226, 0.9);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: white;
    transition: background-color 0.2s;
}

.menu-trigger:hover {
    background-color: rgba(53, 122, 189, 0.9);
}

.submenu {
    display: none;
    position: absolute;
    top: calc(100% - 5px); /* Reduced gap to 5px */
    left: 0;
    background-color: #ffffff;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 1px solid #e1e4e8;
    padding: 4px 0;
    list-style: none;
    z-index: 1002;
}

/* Add a pseudo-element to create a hover bridge */
.menu-item::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 5px; /* Match the gap size */
    background: transparent;
}

.menu-item:hover .submenu {
    display: block;
}

.submenu li {
    margin: 0;
    padding: 0;
}

.submenu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background-color 0.2s;
}

.submenu button:hover {
    background-color: #f5f7fa;
}

.top-container, .bottom-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: min-content;
    gap: 12px;
    padding: 12px;
    background-color: #ffffff;
    min-height: 240px;
    justify-items: stretch;
    align-items: start;
    position: relative;
}

.top-container {
    height: 280px; /* Adjusted height to be between initial and changed values */
    min-height: 280px; /* Match the height */
    flex-shrink: 0;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bottom-container {
    flex-grow: 1;
    overflow-y: auto;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.resize-handle {
    height: 10px;
    background-color: #e1e4e8;
    cursor: ns-resize;
    margin: 0;
    border-radius: 5px;
    transition: background-color 0.2s;
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resize-handle::after {
    content: '';
    width: 40px;
    height: 4px;
    background-color: #c1c9d2;
    border-radius: 2px;
    transition: background-color 0.2s;
}

.resize-handle:hover {
    background-color: #f5f7fa;
}

.resize-handle:hover::after {
    background-color: #4a90e2;
}

.chart-cell {
    border: 1px solid #e1e4e8;
    box-sizing: border-box;
    border-radius: 8px;
    margin: 0;
    padding: 8px;
    background-color: #ffffff;
    position: relative;
    height: 250px;
    min-height: 220px;
    min-width: 0;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    grid-column: span 1;
}

.chart-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.chart-cell.active-chart {
    border: 2px solid #4a90e2 !important;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2) !important;
    transform: translateY(-2px);
    transition: all 0.2s ease-in-out;
}

.ui-state-highlight {
    background: rgba(74, 144, 226, 0.1);
    border: 2px dashed #4a90e2;
    height: 250px !important;
    min-height: 220px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    display: block !important;
    flex: none !important;
    max-width: none !important;
}

.ui-sortable-helper {
    border: 1px solid #4a90e2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.2);
    height: 250px !important;
    min-height: 220px !important;
    width: calc(20% - 12px) !important; /* 5 columns with 12px gap */
    transform: none !important;
    box-sizing: border-box !important;
    padding: 8px !important;
    margin: 0 !important;
    border-radius: 8px !important;
    background-color: #ffffff !important;
    position: absolute !important;
    display: block !important;
    flex: none !important;
    max-width: none !important;
    z-index: 1000 !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.ui-sortable-placeholder {
    visibility: visible !important;
    background: rgba(74, 144, 226, 0.1);
    border: 2px dashed #4a90e2;
    height: 250px !important;
    min-height: 220px !important;
    width: calc(20% - 12px) !important; /* 5 columns with 12px gap */
    margin: 0 !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    border-radius: 8px !important;
    display: block !important;
    flex: none !important;
    max-width: none !important;
}

/* Scrollbar styling */
.bottom-container::-webkit-scrollbar {
    width: 8px;
}

.bottom-container::-webkit-scrollbar-track {
    background: #f5f7fa;
    border-radius: 4px;
}

.bottom-container::-webkit-scrollbar-thumb {
    background: #c1c9d2;
    border-radius: 4px;
}

.bottom-container::-webkit-scrollbar-thumb:hover {
    background: #4a90e2;
}

.layout-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 200px;
}

.layout-dialog h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.layout-dialog button {
    padding: 8px 16px;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    background: #f8f9fa;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.layout-dialog button:hover {
    background: #e9ecef;
    border-color: #d1d5da;
}

.layout-dialog button:last-child {
    margin-top: 10px;
    background: #f1f8ff;
    border-color: #4a90e2;
    color: #4a90e2;
}

.layout-dialog button:last-child:hover {
    background: #e1f0ff;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    background-color: #4CAF50;
}

.notification.error {
    background-color: #f44336;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.chart-number {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 11px;
    color: #666;
    z-index: 1;
    font-weight: 700;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}
