/* Responsive Design - Media Queries for AIOps Platform */

/* Cross-theme fix: make nav-group full sidebar width so left:100% = sidebar right edge */

/* Stretch nav-menu items to fill the full collapsed sidebar width */
.app-container.collapsed .nav-menu {
    padding: 0 !important;
    align-items: stretch !important;
}

/* nav-group fills full width; nav-item centers its icon inside */
.app-container.collapsed .nav-group {
    width: 100%;
    position: relative;
}

.app-container.collapsed .nav-item:not(.submenu-item) {
    width: 100% !important;
    justify-content: center !important;
    padding: 8px 0 !important;
}

/* Submenu grows seamlessly from sidebar right edge */
html[data-theme] .app-container.collapsed .nav-group .submenu,
.app-container.collapsed .nav-group .submenu {
    left: calc(100% - 1px) !important;   /* -1px overlaps the sidebar border-right so no gap */
    transform: none !important;
    margin-left: 0 !important;
    border: none !important;
    border-left: none !important;
    border-radius: 0 8px 8px 0 !important;
    background: var(--bg-sidebar) !important;
    box-shadow: 8px 0 12px -6px rgba(0, 0, 0, 0.35) !important;  /* right-side only, no left halo */
    z-index: var(--z-sidebar) !important; /* same layer as sidebar so left edge is hidden behind sidebar */
}

/* Submenu items: remove left-side radius so they sit flush against the sidebar */
.app-container.collapsed .nav-group .submenu .submenu-item,
.app-container.collapsed .nav-group:hover .submenu .submenu-item {
    border-radius: 0 6px 6px 0 !important;
    margin-left: 0 !important;
    border-left: none !important;
}

/* Hover bridge sized to sidebar width for smooth mouse transition */
html[data-theme] .app-container.collapsed .nav-group .submenu::before,
.app-container.collapsed .nav-group .submenu::before {
    left: calc(-1 * var(--layout-sidebar-collapsed-w)) !important;
    width: var(--layout-sidebar-collapsed-w) !important;
}

/* Base styles are optimized for 1920x1080 (100% scale) */

/* Large screens / 4K (≥2560px) - Increase font size slightly for better readability */
@media (min-width: 2560px) {
    :root {
        font-size: 18px;
    }
    
    .app-container {
        max-width: 2400px;
        margin: 0 auto;
    }
}

/* Laptop / FHD (1366px - 1920px) - Standard scaling */
@media (min-width: 1366px) and (max-width: 1919px) {
    :root {
        font-size: 15px;
    }
}

/* Small laptops / tablets landscape (1024px - 1365px) */
@media (min-width: 1024px) and (max-width: 1365px) {
    :root {
        font-size: 14px;
    }
    
    .app-container {
        grid-template-columns: 160px 1fr 0px;
    }
    
    .app-container.ai-open {
        grid-template-columns: 160px 1fr var(--ai-helper-width);
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .app-container.collapsed .nav-group .submenu {
        min-width: 190px;
        max-height: calc(100vh - 64px);
    }
}

/* Tablets portrait (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        font-size: 14px;
    }
    
    .app-container.collapsed .nav-group .submenu {
        max-height: calc(100vh - 64px);
    }
    
    .sidebar {
        position: fixed;
        left: -250px;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0.75rem;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
}

/* Mobile devices (< 768px) */
@media (max-width: 767px) {
    :root {
        font-size: 14px;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        width: 80%;
        max-width: 280px;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        margin-left: 0;
        padding: 0.5rem;
    }
    
    .header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .header-actions {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .card, .panel {
        padding: 0.75rem;
    }
    
    /* Stack cards vertically on mobile */
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    /* Reduce chart heights on mobile */
    .chart-container {
        min-height: 250px !important;
    }
}

/* High DPI displays (Retina) - Improve sharpness */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .header-actions,
    .revive-chat-btn,
    .theme-zoom-controls {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .app-container {
        max-width: 100%;
    }
}

/* Last-loaded light-theme guard for collapsed sidebar flyouts. */
html[data-theme="light"] .app-container.collapsed .nav-group .submenu,
[data-theme="light"] .app-container.collapsed .nav-group .submenu,
html:not([data-theme]) .app-container.collapsed .nav-group .submenu {
    background: #15181f !important;
    background-color: #15181f !important;
    border: 1px solid #272c36 !important;
    border-left: 3px solid #d81030 !important;
    border-radius: 0 12px 12px 0 !important;
    box-shadow: 18px 16px 34px -18px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.02) !important;
}

html[data-theme="light"] .app-container.collapsed .nav-group .submenu::after,
[data-theme="light"] .app-container.collapsed .nav-group .submenu::after,
html:not([data-theme]) .app-container.collapsed .nav-group .submenu::after {
    background: #15181f !important;
    background-color: #15181f !important;
    border-left-color: #272c36 !important;
    border-bottom-color: #272c36 !important;
}

html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item {
    background: transparent !important;
    background-color: transparent !important;
    border-color: transparent !important;
    color: #c9ced8 !important;
}

html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover {
    background: rgba(216, 16, 48, 0.14) !important;
    background-color: rgba(216, 16, 48, 0.14) !important;
    border-color: rgba(216, 16, 48, 0.28) !important;
    color: #ffffff !important;
}

html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item.active,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item.active,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item.active {
    background: rgba(216, 16, 48, 0.2) !important;
    background-color: rgba(216, 16, 48, 0.2) !important;
    border-color: rgba(216, 16, 48, 0.38) !important;
    color: #ffffff !important;
    box-shadow: inset 3px 0 0 #d81030 !important;
}

html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item svg,
html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item i,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item svg,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item i,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item svg,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item i {
    color: #8a909c !important;
    stroke: #8a909c !important;
}

html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover svg,
html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover i,
html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item.active svg,
html[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item.active i,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover svg,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover i,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item.active svg,
[data-theme="light"] .app-container.collapsed .nav-group:hover .submenu .submenu-item.active i,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover svg,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item:hover i,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item.active svg,
html:not([data-theme]) .app-container.collapsed .nav-group:hover .submenu .submenu-item.active i {
    color: #d81030 !important;
    stroke: #d81030 !important;
}

/* Zynork light-theme blue cleanup for template utility classes and inline legacy styles. */
html[data-theme="light"] .bg-blue-50,
html[data-theme="light"] .bg-blue-100,
html[data-theme="light"] .hover\:bg-blue-50:hover,
html[data-theme="light"] .hover\:bg-blue-100:hover,
html[data-theme="light"] [class*="bg-[#eff6ff]"],
html[data-theme="light"] [class*="bg-[#dbeafe]"],
html[data-theme="light"] [class*="hover:bg-[#dbeafe]"]:hover,
html[data-theme="light"] [style*="background: #eff6ff"],
html[data-theme="light"] [style*="background:#eff6ff"],
html[data-theme="light"] [style*="background-color: #eff6ff"],
html[data-theme="light"] [style*="background-color:#eff6ff"],
html[data-theme="light"] [style*="background: #dbeafe"],
html[data-theme="light"] [style*="background:#dbeafe"],
html[data-theme="light"] [style*="background-color: #dbeafe"],
html[data-theme="light"] [style*="background-color:#dbeafe"],
html[data-theme="light"] [style*="linear-gradient(135deg, #eff6ff"],
html[data-theme="light"] [style*="linear-gradient(135deg,#eff6ff"] {
    background: #fdecee !important;
    background-color: #fdecee !important;
}

html[data-theme="light"] .bg-blue-500,
html[data-theme="light"] .bg-blue-600,
html[data-theme="light"] .bg-blue-700,
html[data-theme="light"] .hover\:bg-blue-500:hover,
html[data-theme="light"] .hover\:bg-blue-600:hover,
html[data-theme="light"] .hover\:bg-blue-700:hover,
html[data-theme="light"] [class*="bg-[#3b82f6]"],
html[data-theme="light"] [class*="bg-[#2563eb]"],
html[data-theme="light"] [class*="hover:bg-[#3b82f6]"]:hover,
html[data-theme="light"] [class*="hover:bg-[#2563eb]"]:hover,
html[data-theme="light"] [style*="background: #3b82f6"],
html[data-theme="light"] [style*="background:#3b82f6"],
html[data-theme="light"] [style*="background-color: #3b82f6"],
html[data-theme="light"] [style*="background-color:#3b82f6"],
html[data-theme="light"] [style*="background: #2563eb"],
html[data-theme="light"] [style*="background:#2563eb"],
html[data-theme="light"] [style*="background-color: #2563eb"],
html[data-theme="light"] [style*="background-color:#2563eb"],
html[data-theme="light"] [style*="linear-gradient(135deg, #3b82f6"],
html[data-theme="light"] [style*="linear-gradient(135deg,#3b82f6"],
html[data-theme="light"] [style*="linear-gradient(135deg, #2563eb"],
html[data-theme="light"] [style*="linear-gradient(135deg,#2563eb"] {
    background: #d81030 !important;
    background-color: #d81030 !important;
}

html[data-theme="light"] .border-blue-300,
html[data-theme="light"] .border-blue-400,
html[data-theme="light"] .border-blue-500,
html[data-theme="light"] .focus\:border-blue-500:focus,
html[data-theme="light"] .hover\:border-blue-500:hover,
html[data-theme="light"] [class*="border-[#3b82f6]"],
html[data-theme="light"] [class*="border-[#2563eb]"],
html[data-theme="light"] [class*="border-[#bfdbfe]"],
html[data-theme="light"] [style*="border-color: #3b82f6"],
html[data-theme="light"] [style*="border-color:#3b82f6"],
html[data-theme="light"] [style*="border-color: #2563eb"],
html[data-theme="light"] [style*="border-color:#2563eb"],
html[data-theme="light"] [style*="border: 1px solid #bfdbfe"],
html[data-theme="light"] [style*="border:1px solid #bfdbfe"] {
    border-color: #d81030 !important;
}

html[data-theme="light"] .border-blue-100,
html[data-theme="light"] [class*="border-[#dbeafe]"],
html[data-theme="light"] [style*="border-color: #dbeafe"],
html[data-theme="light"] [style*="border-color:#dbeafe"],
html[data-theme="light"] [style*="border: 1px solid #dbeafe"],
html[data-theme="light"] [style*="border:1px solid #dbeafe"] {
    border-color: #0e10151a !important;
}

html[data-theme="light"] [style*="border-left: 3px solid #3b82f6"],
html[data-theme="light"] [style*="border-left:3px solid #3b82f6"],
html[data-theme="light"] [style*="border-left: 4px solid #3b82f6"],
html[data-theme="light"] [style*="border-left:4px solid #3b82f6"] {
    border-left-color: #d81030 !important;
}

html[data-theme="light"] .ring-blue-500,
html[data-theme="light"] .focus\:ring-blue-500:focus,
html[data-theme="light"] [class*="ring-[#3b82f6]"],
html[data-theme="light"] [class*="focus:ring-[#3b82f6]"]:focus {
    --tw-ring-color: rgba(216, 16, 48, 0.22) !important;
    box-shadow: 0 0 0 3px rgba(216, 16, 48, 0.16) !important;
}

html[data-theme="light"] .text-blue-300:not(svg):not(i),
html[data-theme="light"] .text-blue-400:not(svg):not(i),
html[data-theme="light"] .text-blue-500:not(svg):not(i),
html[data-theme="light"] .text-blue-600:not(svg):not(i),
html[data-theme="light"] .text-blue-700:not(svg):not(i),
html[data-theme="light"] .text-blue-800:not(svg):not(i),
html[data-theme="light"] .hover\:text-blue-300:hover,
html[data-theme="light"] .hover\:text-blue-400:hover,
html[data-theme="light"] .hover\:text-blue-500:hover,
html[data-theme="light"] .hover\:text-blue-600:hover,
html[data-theme="light"] .hover\:text-blue-700:hover,
html[data-theme="light"] .hover\:text-blue-800:hover,
html[data-theme="light"] [class*="text-[#3b82f6]"]:not(svg):not(i),
html[data-theme="light"] [class*="text-[#2563eb]"]:not(svg):not(i),
html[data-theme="light"] [class*="text-[#1d4ed8]"]:not(svg):not(i),
html[data-theme="light"] [class*="hover:text-[#3b82f6]"]:hover,
html[data-theme="light"] [class*="hover:text-[#2563eb]"]:hover,
html[data-theme="light"] [class*="hover:text-[#1d4ed8]"]:hover,
html[data-theme="light"] [style*="color: #3b82f6"]:not(svg):not(i),
html[data-theme="light"] [style*="color:#3b82f6"]:not(svg):not(i),
html[data-theme="light"] [style*="color: #2563eb"]:not(svg):not(i),
html[data-theme="light"] [style*="color:#2563eb"]:not(svg):not(i),
html[data-theme="light"] [style*="color: #1d4ed8"]:not(svg):not(i),
html[data-theme="light"] [style*="color:#1d4ed8"]:not(svg):not(i) {
    color: #334155 !important;
}

html[data-theme="light"] svg.text-blue-300,
html[data-theme="light"] svg.text-blue-400,
html[data-theme="light"] svg.text-blue-500,
html[data-theme="light"] svg.text-blue-600,
html[data-theme="light"] svg.text-blue-700,
html[data-theme="light"] i.text-blue-300,
html[data-theme="light"] i.text-blue-400,
html[data-theme="light"] i.text-blue-500,
html[data-theme="light"] i.text-blue-600,
html[data-theme="light"] i.text-blue-700,
html[data-theme="light"] svg[class*="text-[#3b82f6]"],
html[data-theme="light"] svg[class*="text-[#2563eb]"],
html[data-theme="light"] svg[class*="text-[#1d4ed8]"],
html[data-theme="light"] i[class*="text-[#3b82f6]"],
html[data-theme="light"] i[class*="text-[#2563eb]"],
html[data-theme="light"] i[class*="text-[#1d4ed8]"],
html[data-theme="light"] svg[style*="color: #3b82f6"],
html[data-theme="light"] i[style*="color: #3b82f6"],
html[data-theme="light"] svg[style*="color:#3b82f6"],
html[data-theme="light"] i[style*="color:#3b82f6"],
html[data-theme="light"] svg[style*="color: #2563eb"],
html[data-theme="light"] i[style*="color: #2563eb"],
html[data-theme="light"] svg[style*="color:#2563eb"],
html[data-theme="light"] i[style*="color:#2563eb"] {
    color: #d81030 !important;
    stroke: #d81030 !important;
}

html[data-theme="light"] input[type="checkbox"],
html[data-theme="light"] input[type="radio"],
html[data-theme="light"] [style*="accent-color: #3b82f6"],
html[data-theme="light"] [style*="accent-color:#3b82f6"] {
    accent-color: #d81030 !important;
}

html[data-theme="light"] button[style*="linear-gradient(135deg, #3b82f6"],
html[data-theme="light"] button[style*="linear-gradient(135deg,#3b82f6"],
html[data-theme="light"] button[style*="linear-gradient(135deg, #2563eb"],
html[data-theme="light"] button[style*="linear-gradient(135deg,#2563eb"],
html[data-theme="light"] button[style*="rgba(59,130,246"],
html[data-theme="light"] button[style*="rgba(59, 130, 246"] {
    box-shadow: 0 1px 2px rgba(216, 16, 48, 0.28) !important;
}

html[data-theme="light"] button[style*="color: #3b82f6"] i,
html[data-theme="light"] button[style*="color: #3b82f6"] svg,
html[data-theme="light"] button[style*="color:#3b82f6"] i,
html[data-theme="light"] button[style*="color:#3b82f6"] svg,
html[data-theme="light"] button[style*="color: #2563eb"] i,
html[data-theme="light"] button[style*="color: #2563eb"] svg,
html[data-theme="light"] button[style*="color:#2563eb"] i,
html[data-theme="light"] button[style*="color:#2563eb"] svg {
    color: #d81030 !important;
    stroke: #d81030 !important;
}
