@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* TODO: Add Gotham font files to project for full implementation */
/* Currently using fallback fonts until Gotham fonts are available */

:root {
    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border-color: rgba(70, 71, 73, 0.2);
    --color-primary: #464749;
    --color-accent: #156082;
    
    /* Font families */
    --font-body: "Gotham Rounded Book", "Gotham Rounded", "Gotham", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --font-heading: "Gotham Book", "Gotham", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

[data-theme="dark"] {
    /* Dark mode colors - Professional Black & Gold */
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --text-primary: #ffffff;
    --text-secondary: #d1d5db;
    --border-color: rgba(245, 196, 66, 0.2);
    --color-primary: #f5c842;
    --color-accent: #ffd966;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .font-heading {
    font-family: var(--font-heading);
}

/* Static subtle background */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(70, 71, 73, 0.02) 0%, rgba(21, 96, 130, 0.03) 100%);
    z-index: -1;
    pointer-events: none;
}

[data-theme="dark"] body::before {
    background: linear-gradient(135deg, rgba(245, 196, 66, 0.05) 0%, rgba(255, 217, 102, 0.03) 100%);
}

/* ============================================
   HIERARCHICAL MENU STYLES
   ============================================ */

/* Portfolio Mega Category Styles */
#portfolio-categories-container {
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
    max-height: 10000px;
    opacity: 1;
}

#portfolio-categories-container.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
}

#portfolio-chevron {
    transition: transform 0.3s ease;
}

#portfolio-chevron.collapsed {
    transform: rotate(-90deg);
}

/* Category Styles */
.category-section {
    margin-bottom: 8px;
}

.category-header .category-chevron {
    transition: transform 0.3s ease;
}

.category-header.expanded .category-chevron {
    transform: rotate(180deg);
}

.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
    opacity: 0;
}

.category-content.expanded {
    max-height: 1000px;
    opacity: 1;
}

/* Authority & Sector Styles (Authority -> Sector -> Category) */
.authority-section {
    margin-bottom: 8px;
}

.authority-header .authority-chevron {
    transition: transform 0.3s ease;
}

.authority-header.expanded .authority-chevron {
    transform: rotate(180deg);
}

.authority-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
    opacity: 0;
    /* Small indentation so sectors read as children of the Authority */
    margin-left: 6px;
    padding-left: 6px;
    margin-top: 4px;
}

.authority-content.expanded {
    max-height: 10000px;
    opacity: 1;
}

.sector-section {
    margin-bottom: 8px;
}

.sector-header .sector-chevron {
    transition: transform 0.3s ease;
}

.sector-header.expanded .sector-chevron {
    transform: rotate(180deg);
}

.sector-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
    opacity: 0;
    /* Small indentation so categories read as children of the sector */
    margin-left: 8px;
    padding-left: 6px;
    margin-top: 4px;
}

.sector-content.expanded {
    max-height: 10000px;
    opacity: 1;
}

/* Group Styles */
.group-section {
    margin-bottom: 6px;
}

.group-header .group-chevron {
    transition: transform 0.3s ease;
}

.group-header.expanded .group-chevron {
    transform: rotate(180deg);
}

.group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease;
    opacity: 0;
}

.group-content.expanded {
    max-height: 500px;
    opacity: 1;
}

/* Icon Size Normalization - Ensure consistent visual size across all sidebar icons */
/* Feather icons can have different visual sizes even with same CSS dimensions */
/* This normalizes the visual appearance by setting consistent stroke-width and viewBox handling */

/* Sector icons - normalize both the container and SVG */
.sector-header i[data-feather],
.sector-header-clickable i[data-feather] {
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.sector-header svg,
.sector-header-clickable svg {
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    flex-shrink: 0 !important;
    display: block !important;
    stroke-width: 2 !important;
}

/* Category icons - normalize both the container and SVG */
.category-header i[data-feather],
.category-header-clickable i[data-feather] {
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.category-header svg,
.category-header-clickable svg {
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    flex-shrink: 0 !important;
    display: block !important;
    stroke-width: 2 !important;
}

/* Group icons - normalize both the container and SVG */
.group-header i[data-feather] {
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.group-header svg {
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem !important;
    min-height: 1rem !important;
    flex-shrink: 0 !important;
    display: block !important;
    stroke-width: 2 !important;
}

/* Process Item Styles */
.process-item {
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border-left: 3px solid transparent;
}

.process-item:hover {
    background: rgba(70, 71, 73, 0.08);
    transform: translateX(2px);
}

[data-theme="dark"] .process-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.process-item.active {
    background: rgba(70, 71, 73, 0.1);
    border-left-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(70, 71, 73, 0.1);
}

[data-theme="dark"] .process-item.active {
    background: rgba(107, 109, 112, 0.15);
    border-left-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Process step animation */
.step-item {
    position: relative;
    padding-left: 32px;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.5s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--color-accent);
    background: var(--bg-primary);
}

.step-item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 22px;
    width: 2px;
    height: calc(100% - 16px);
    background: rgba(21, 96, 130, 0.3);
}

[data-theme="dark"] .step-item:not(:last-child)::after {
    background: rgba(30, 123, 168, 0.3);
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(21, 96, 130, 0.3);
    border-radius: 50%;
    border-top-color: var(--color-accent);
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Theme toggle button */
.theme-toggle-btn {
    flex-shrink: 0;
    position: relative;
    bottom: auto;
    left: auto;
    width: 100%;
    padding: 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    transition: all 0.3s ease;
    z-index: 100;
}

.theme-toggle-btn button {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: var(--color-primary);
    color: white;
    font-family: var(--font-heading);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.theme-toggle-btn button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle-btn button:active {
    transform: translateY(0);
}

[data-theme="dark"] .theme-toggle-btn button {
    background: var(--color-accent);
}

/* Logo visibility in dark mode - Enhanced */
[data-theme="dark"] img[alt="Digital Dubai Logo"] {
    filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(200%) contrast(100%);
}

/* Additional dark mode body styles - Professional Black & Gold */
[data-theme="dark"] body {
    background-color: #000000;
    color: #ffffff;
}

/* Dark mode for all cards */
[data-theme="dark"] .backdrop-blur-xl {
    background-color: rgba(20, 20, 20, 0.9) !important;
    border-color: rgba(245, 196, 66, 0.3) !important;
}

/* Dark mode for stat cards */
[data-theme="dark"] .rounded-2xl,
[data-theme="dark"] .rounded-xl {
    background-color: rgba(20, 20, 20, 0.95) !important;
    border-color: rgba(245, 196, 66, 0.3) !important;
}

/* Dark mode sidebar */
[data-theme="dark"] #sidebar {
    background-color: #0a0a0a !important;
    border-color: rgba(245, 196, 66, 0.2) !important;
}

/* Dark mode for main content area */
[data-theme="dark"] .flex-1 {
    background-color: #000000 !important;
}

/* Dark mode for all white backgrounds */
[data-theme="dark"] .bg-white {
    background-color: rgba(20, 20, 20, 0.95) !important;
}

/* Stat cards - prevent number overflow on mobile */
@media (max-width: 640px) {
    #process-velocity,
    #process-accuracy,
    #process-compliance,
    #process-cost {
        font-size: 1rem !important; /* Force smaller on mobile */
        line-height: 1.25rem;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    /* Ensure stat cards don't overflow */
    .grid.grid-cols-2 > div {
        min-width: 0; /* Allow flex items to shrink below content size */
    }
}

/* Maturity Level Animations */
#maturity-circle {
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

#maturity-score {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Workflow improvements animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for 3-column layout */
@media (max-width: 1023px) {
    /* Stack columns on tablet/mobile */
    .grid.grid-cols-1.lg\\:grid-cols-3 {
        grid-template-columns: 1fr;
    }
}

/* Ensure equal width columns on large screens */
@media (min-width: 1024px) {
    .grid.grid-cols-1.lg\\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Dark mode icons and accents */
[data-theme="dark"] .text-primary,
[data-theme="dark"] .bg-primary\/10 {
    color: #f5c842 !important;
    background-color: rgba(245, 196, 66, 0.1) !important;
}

[data-theme="dark"] .text-accent,
[data-theme="dark"] .bg-accent\/10 {
    color: #ffd966 !important;
    background-color: rgba(255, 217, 102, 0.1) !important;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Mobile menu button */
#mobile-menu-btn {
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    z-index: 9999 !important; /* Always on top of everything */
    position: fixed !important;
}

#mobile-menu-btn:hover {
    transform: scale(1.05);
}

#mobile-menu-btn:active {
    transform: scale(0.95);
}

/* Sidebar enhancements */
#sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

#sidebar > .p-6 {
    flex-shrink: 0;
}

#sidebar > nav {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 0 !important;
}

/* Force sidebar off-screen on mobile when closed */
@media (max-width: 1023px) {
    #sidebar:not(.open) {
        transform: translateX(-100%) !important;
    }
}

#sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 50 !important; /* Above overlay for proper interaction */
}

[data-theme="dark"] #sidebar.open {
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
}

/* Sidebar scrollbar styling */
#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}

/* Mobile overlay */
#mobile-overlay {
    transition: opacity 0.3s ease;
    opacity: 0;
    z-index: 45 !important; /* Between content and sidebar when open */
}

#mobile-overlay.show {
    display: block;
    opacity: 1;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Tablet and Mobile adjustments */
@media (max-width: 1023px) {
    #sidebar {
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    }
    
    /* Adjust theme toggle for mobile */
    .theme-toggle-btn {
        width: 100%;
        max-width: 320px;
    }
    
    /* Ensure main content doesn't get hidden under sidebar */
    .flex-1 {
        width: 100%;
        max-width: 100%;
    }
}

/* Touch-friendly interactive elements */
@media (max-width: 768px) {
    .process-item {
        padding: 14px 12px;
        min-height: 60px;
    }
    
    button, .process-item, .category-header, .group-header {
        -webkit-tap-highlight-color: rgba(21, 96, 130, 0.1);
    }
    
    /* Larger touch targets */
    #theme-toggle {
        min-height: 48px;
    }
        min-height: 48px;
    }
    
    .category-header, .group-header {
        min-height: 44px;
    }
    
    /* Better spacing on mobile */
    .backdrop-blur-xl {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    
    /* Optimize cards for mobile viewing */
    .rounded-2xl {
        padding: 1rem;
    }
}

/* Small mobile devices */
@media (max-width: 640px) {
    /* Reduce border radius for mobile */
    .rounded-2xl {
        border-radius: 1rem;
    }
    
    .rounded-xl {
        border-radius: 0.75rem;
    }
    
    /* Ensure logo scales properly */
    img[alt="Digital Dubai Logo"] {
        max-height: 48px;
    }
    
    /* Compact sidebar navigation */
    nav h3 {
        font-size: 0.7rem;
    }
    
    /* Optimize process items */
    .process-item {
        padding: 12px 10px;
    }
    
    .process-item span {
        font-size: 0.875rem;
    }
    
    /* Better button sizing */
    #reanalyze-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.875rem;
    }
}

/* Extra small devices */
@media (max-width: 374px) {
    .process-item {
        padding: 10px 8px;
    }
    
    .category-header, .group-header {
        padding: 8px;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .p-6, .p-8 {
        padding: 1rem;
    }
    
    .mb-6, .mb-8 {
        margin-bottom: 1rem;
    }
    
    #sidebar {
        padding-bottom: 4rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

* {
    -webkit-overflow-scrolling: touch;
}

/* Performance optimizations */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Prevent zoom on input focus (iOS) */
input, select, textarea {
    font-size: 16px;
}

/* Hardware acceleration for smooth animations */
#sidebar,
#mobile-overlay,
#mobile-menu-btn,
.process-item,
.category-content,
.group-content {
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* ============================================
   WORKFLOW DIAGRAM STYLING
   ============================================ */

/* Workflow diagram container - consistent sizing */
.workflow-diagram-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

/* Workflow diagram image - responsive sizing for center column */
.workflow-diagram-img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    display: block;
}

/* Center column workflow diagram container */
#workflow-diagram-container {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Responsive adjustments for workflow diagram */
@media (max-width: 1023px) {
    #workflow-diagram-container {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    .workflow-diagram-container {
        max-width: 100%;
    }
    
    .workflow-diagram-img {
        max-width: 100%;
        max-height: 300px;
    }
    
    #workflow-diagram-container {
        min-height: 200px;
    }
}

@media (max-width: 640px) {
    .workflow-diagram-img {
        max-height: 250px;
    }
    
    #workflow-diagram-container {
        min-height: 180px;
    }
}

/* Better focus states for accessibility */
button:focus-visible,
.process-item:focus-visible,
.category-header:focus-visible,
.group-header:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Notification positioning */
@media (max-width: 640px) {
    .fixed.top-4.right-4 {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: calc(100% - 2rem);
    }
}

/* Card entrance animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.backdrop-blur-xl {
    animation: slideUp 0.4s ease-out;
}

/* Hover effects for desktop */
@media (hover: hover) and (pointer: fine) {
    .category-header:hover,
    .group-header:hover {
        background: rgba(70, 71, 73, 0.05);
    }
    
    [data-theme="dark"] .category-header:hover,
    [data-theme="dark"] .group-header:hover {
        background: rgba(255, 255, 255, 0.03);
    }
}

/* Active states for mobile */
@media (hover: none) and (pointer: coarse) {
    button:active {
        transform: scale(0.96);
        transition: transform 0.1s ease;
    }
    
    .category-header:active,
    .group-header:active {
        background: rgba(70, 71, 73, 0.08);
    }
    
    [data-theme="dark"] .category-header:active,
    [data-theme="dark"] .group-header:active {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Prevent text selection on interactive elements */
button, .process-item, .category-header, .group-header {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* Safe area handling for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    #mobile-menu-btn {
        top: max(1rem, env(safe-area-inset-top));
        left: max(1rem, env(safe-area-inset-left));
    }
    
    #sidebar {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(80px, env(safe-area-inset-bottom));
    }
}

/* ============================================
   AI THINKING PROCESS BUTTON & MODAL STYLES
   ============================================ */

/* Thinking Process Button */
#thinking-process-btn {
    position: relative;
    overflow: hidden;
}

#thinking-process-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#thinking-process-btn:hover::before {
    width: 300px;
    height: 300px;
}

#thinking-process-btn:active {
    transform: scale(0.98);
}

/* Thinking Modal */
#thinking-modal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#thinking-modal > div {
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#thinking-content, #thinking-rashed-content {
    line-height: 1.8;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
}

/* Tab styles for thinking panel */
.tab-btn {
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #1a1a1a;
}

.tab-content {
    display: block;
}

.tab-content.hidden {
    display: none;
}

/* Modal scrollbar styling */
#thinking-modal .overflow-y-auto::-webkit-scrollbar {
    width: 10px;
}

#thinking-modal .overflow-y-auto::-webkit-scrollbar-track {
    background: rgba(156, 163, 175, 0.1);
    border-radius: 10px;
}

#thinking-modal .overflow-y-auto::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #a855f7, #6366f1);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

#thinking-modal .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #9333ea, #4f46e5);
    background-clip: padding-box;
}

/* Pulse animation for lightning bolt */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* AI Thinking Side Panel Styles */
#thinking-panel {
    will-change: width;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

#thinking-panel.open {
    width: 500px;
}

@media (max-width: 1023px) {
    #thinking-panel.open {
        width: 90%;
    }
}

#thinking-panel-overlay {
    display: none;
}

@media (max-width: 1023px) {
    #thinking-panel-overlay.show {
        display: block;
    }
}

/* Thinking Panel Container - Ensure proper flex layout */
#thinking-panel > div.flex.flex-col {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

/* Thinking Panel Scrollable Content - Critical for scrolling */
#thinking-panel .flex-1.overflow-y-auto {
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0 !important;
    flex: 1 1 0%;
}

#thinking-panel .flex-1::-webkit-scrollbar {
    width: 8px;
}

#thinking-panel .flex-1::-webkit-scrollbar-track {
    background: transparent;
}

#thinking-panel .flex-1::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 4px;
}

#thinking-panel .flex-1::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}

[data-theme="dark"] #thinking-panel .flex-1::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.4);
}

[data-theme="dark"] #thinking-panel .flex-1::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.6);
}

/* Chat Input Styling */
#thinking-chat-input {
    transition: all 0.2s ease;
    line-height: 1.5;
    max-height: 120px;
}

#thinking-chat-input:focus {
    box-shadow: 0 0 0 3px rgba(70, 71, 73, 0.1);
}

[data-theme="dark"] #thinking-chat-input:focus {
    box-shadow: 0 0 0 3px rgba(245, 196, 66, 0.2);
}

#thinking-chat-send-btn {
    min-width: 44px;
    min-height: 44px;
}

#thinking-chat-send-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

#thinking-chat-send-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* Chat Messages Styling */
#chat-messages-container {
    font-family: var(--font-body);
}

.chat-message {
    animation: fadeInUp 0.3s ease-out;
}

.chat-message-user {
    background: linear-gradient(135deg, rgba(70, 71, 73, 0.1) 0%, rgba(21, 96, 130, 0.1) 100%);
    border: 1px solid rgba(70, 71, 73, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
}

[data-theme="dark"] .chat-message-user {
    background: linear-gradient(135deg, rgba(245, 196, 66, 0.15) 0%, rgba(255, 217, 102, 0.1) 100%);
    border-color: rgba(245, 196, 66, 0.3);
}

.chat-message-ai {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
}

[data-theme="dark"] .chat-message-ai {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(99, 102, 241, 0.2) 100%);
    border-color: rgba(139, 92, 246, 0.3);
}

/* AI Thinking Animation */
.ai-thinking-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(139, 92, 246, 0.8);
}

[data-theme="dark"] .ai-thinking-indicator {
    color: rgba(196, 181, 253, 0.8);
}

.ai-thinking-dots {
    display: flex;
    gap: 4px;
}

.ai-thinking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: thinkingPulse 1.4s ease-in-out infinite;
}

.ai-thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingPulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile responsiveness for thinking button */
@media (max-width: 640px) {
    #thinking-process-btn {
        padding: 0.625rem 0.75rem;
        min-width: 44px;
    }
    
    #thinking-chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    #thinking-panel .flex-1 {
        padding: 1rem;
    }
}

/* ============================================
   ACTIVITY TYPE LIST STYLING
   ============================================ */

/* Activity type list container */
#activity-type-list-container {
    animation: slideUp 0.3s ease-out;
}

/* Activity list scrollbar styling */
#activity-type-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.3) transparent;
}

#activity-type-list::-webkit-scrollbar {
    width: 6px;
}

#activity-type-list::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 3px;
}

#activity-type-list::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 3px;
}

#activity-type-list::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}

/* Activity item hover effects */
#activity-type-list > div {
    transition: all 0.2s ease;
}

#activity-type-list > div:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] #activity-type-list > div:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Close button styling */
#close-activity-type-list {
    transition: all 0.2s ease;
}

#close-activity-type-list:hover {
    transform: scale(1.1);
}

/* Responsive adjustments for activity list */
@media (max-width: 768px) {
    #activity-type-list {
        max-height: 300px;
    }
}

@media (max-width: 640px) {
    #activity-type-list {
        max-height: 250px;
    }
    
    #activity-type-list > div {
        padding: 0.75rem;
    }
}

/* ============================================
   TRANSFORMATION KPI GAUGE TOOLTIPS
   ============================================ */

/* Ensure parent containers allow tooltips to overflow */
.home-view,
.flex-1 {
    overflow: visible !important;
}

/* Ensure gauge cards allow tooltips to overflow */
#home-transformation-gauges {
    overflow: visible !important;
    position: relative;
}

/* Home view mode toggle (General / Zero bureaucracy) */
.kpi-mode-button {
    position: relative;
    padding: 0.4rem 1.4rem;
    font-size: 0.85rem;
    line-height: 1.25rem;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.kpi-mode-button-active {
    background: var(--color-primary);
    color: #ffffff;
    transform: translateY(-1px);
}

[data-theme="dark"] .kpi-mode-button-active {
    background: var(--color-accent);
    color: #000000;
}

/* KPI card swap animation */
.home-kpis-animated {
    animation: homeKpiSwap 0.3s ease-out;
}

@keyframes homeKpiSwap {
    0% {
        opacity: 0;
        transform: translateY(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Home Categories collapsible content */
.home-categories-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    margin-top: 0;
}

.home-categories-content.expanded {
    max-height: 2000px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 1.5rem;
}

/* Ensure gauge cards don't clip tooltips */
#home-transformation-gauges > div[data-home-gauge] {
    overflow: visible !important;
    position: relative;
}

/* When hovering, bring the card to front */
#home-transformation-gauges > div[data-home-gauge]:hover {
    z-index: 10001 !important;
    position: relative;
}

/* Ensure tooltips are always on top - target the tooltip divs specifically */
#home-transformation-gauges > div[data-home-gauge] > div[class*="absolute"] {
    z-index: 10002 !important;
    pointer-events: auto;
    position: absolute !important;
}

/* Ensure ghost gauges are always visible regardless of target vs actual value */
.kpi-gauge-ghost {
    opacity: 0.3 !important;
    display: block !important;
    visibility: visible !important;
    pointer-events: none;
}

/* ============================================
   ACTIVITY PROMPT TABLE MODAL STYLING
   ============================================ */

#activity-prompt-modal table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.875rem;
}

#activity-prompt-modal table thead {
    background-color: var(--color-primary);
    color: white;
}

[data-theme="dark"] #activity-prompt-modal table thead {
    background-color: var(--color-accent);
    color: #000000;
}

#activity-prompt-modal table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] #activity-prompt-modal table th {
    border-color: rgba(255, 255, 255, 0.2);
}

#activity-prompt-modal table td {
    padding: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] #activity-prompt-modal table td {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(20, 20, 20, 0.95);
}

#activity-prompt-modal table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] #activity-prompt-modal table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
}

#activity-prompt-modal table tbody tr:hover {
    background-color: rgba(21, 96, 130, 0.1);
}

[data-theme="dark"] #activity-prompt-modal table tbody tr:hover {
    background-color: rgba(245, 196, 66, 0.15);
}

#activity-prompt-modal table strong {
    color: var(--color-accent);
    font-weight: 600;
}

[data-theme="dark"] #activity-prompt-modal table strong {
    color: var(--color-accent);
}

/* Responsive table styling */
@media (max-width: 768px) {
    #activity-prompt-modal table {
        font-size: 0.75rem;
    }
    
    #activity-prompt-modal table th,
    #activity-prompt-modal table td {
        padding: 0.5rem;
    }
}

/* Show Prompt Button Styling */
#show-prompt-btn {
    transition: all 0.2s ease;
}

#show-prompt-btn:hover {
    transform: translateY(-1px);
}

#show-prompt-btn:active {
    transform: translateY(0);
}

