/* ==========================================================================
   1. CSS Variables
   ========================================================================== */
:root {
    /* Colors */
    --color-primary: #F59E0B; /* yellow-500 */
    --color-text-dark: #1f2937; /* gray-800 */
    --color-text-medium: #374151; /* gray-700 */
    --color-text-light: #6b7280; /* gray-500 */
    --color-text-white: #ffffff;
    --color-bg-light: #f9fafb; /* gray-50 */
    --color-bg-medium: #f0f0f0;
    --color-border: #d1d5db; /* gray-300 */
    --color-link: #3498db;
    --color-success: #16a34a; /* green-600 */
    --color-prose-headings: #2c3e50;

    /* Z-Indexes */
    --z-index-content: 10;
    --z-index-loading-overlay: 40;
    --z-index-header: 50;
    --z-index-modal-contextual: 60;
    --z-index-modal-global: 100;
    --z-index-tooltip: 9998;
    --z-index-notification: 9999;
}

/* ==========================================================================
   2. Base & Global Styles
   ========================================================================== */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

p, div, span, h1, h2, h3, h4, h5, h6 {
    caret-color: transparent;
}

input, textarea {
    caret-color: currentColor !important;
}

[x-cloak] {
    display: none;
}

/* ==========================================================================
   3. Animations & Keyframes
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes blinking-text {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

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

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

@keyframes pulseAvatarAnimation {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

/* ==========================================================================
   4. Layout
   ========================================================================== */
nav {
    flex-shrink: 0;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#logo-sidebar {
    width: 256px; /* w-64 */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#logo-sidebar > div {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#logo-sidebar ul {
    margin-top: 0;
    padding-top: 1rem;
}

#app {
    flex: 1;
    overflow-y: auto;
    position: relative;
    z-index: var(--z-index-content);
}

.login-section-bg {
    background-image: url('/static/images/background.opti.webp');
    background-size: cover;
    background-position: center;
}

@media (max-width: 768px) {
    .login-section-bg {
        background-image: url('/static/images/background-mobile.opti.webp');
    }
}

@media (max-width: 640px) {
    .main-container {
        flex-direction: column;
    }
    #logo-sidebar {
        width: 100%;
        height: auto;
    }
}

/* ==========================================================================
   5. Utility Classes
   ========================================================================== */
.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 1s ease-in-out;
}

.fade-in-events {
    animation: fadeIn 0.5s; /* Consolidated from fadeInEvents */
}

.truncate-3-lines {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-scrollbar::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}
.no-scrollbar {
    -ms-overflow-style: none;  /* IE 10+ */
    scrollbar-width: none;
}

.animate-spin {
    animation: spin 1s linear infinite !important;
}

.animate-spin-slow {
    animation: spin-slow 2s linear infinite;
}

.animate-pulse-avatar {
    animation: pulseAvatarAnimation 1.5s infinite ease-in-out;
}

.htmx-indicator {
    display: none;
  }
  /* Show indicator when htmx adds the class directly on it */
  .htmx-indicator.htmx-request {
    display: flex;
  }
  .htmx-request .htmx-indicator {
    display: inline-flex;
  }
  .htmx-request .htmx-indicator-hide {
    display: none;
  }

/* Ensure global overlay indicators can show even if not nested under the requesting element */
body.htmx-request #global-loading-overlay {
    display: flex !important;
}

/* Z-Index Utilities */
.z-40 { z-index: var(--z-index-loading-overlay) !important; }
.z-50 { z-index: var(--z-index-header) !important; }
.z-tooltip { z-index: var(--z-index-tooltip) !important; }

/* ==========================================================================
   6. Components
   ========================================================================== */

/* --- Accordions visibility on hover when expanded --- */
#accordion-general button[aria-expanded='true']:hover,
#accordion-profile button[aria-expanded='true']:hover {
    color: #111827; /* gray-900 for strong contrast */
}

/* --- Modals --- */
.modal-blur {
    backdrop-filter: blur(5px);
    background-color: rgba(0, 0, 0, 0.5);
    z-index: var(--z-index-modal-global);
}

.modal-global {
    z-index: var(--z-index-modal-global) !important;
}

.modal-contextual {
    z-index: var(--z-index-modal-contextual) !important;
}

.modal-content {
    background-color: var(--color-text-white);
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    margin: 2rem auto;
}

.modal-container {
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
}

/* --- Notifications --- */
#notification-container {
    z-index: var(--z-index-notification) !important;
}

/* --- Cards --- */
.card-image-bg {
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-text-white);
    z-index: 20; /* This seems contextual, leaving as is */
}

.card-image-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 40%, rgba(255,255,255,0) 100%);
    z-index: 0;
}

.card-image-bg > * {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .card-image-bg::before {
        backdrop-filter: blur(4px);
        mask-image: linear-gradient(to right, rgba(255,255,255,0.9), rgba(255,255,255,0.2));
    }
}

@media (max-width: 480px) {
    .card-image-bg {
        background-position: center right;
    }
    .card-image-bg::before {
        backdrop-filter: blur(2px);
        mask-image: linear-gradient(to right, rgba(255,255,255,0.8), rgba(255,255,255,0.1));
    }
}

/* --- Forms --- */
/* Ensure consistent focus styles across all form elements */
input:focus, select:focus, textarea:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgb(220 252 231) !important; /* ring-2 ring-green-100 */
    border-color: rgb(74 222 128) !important; /* border-green-400 */
}

/* Force consistent focus styles for all form elements in aigen forms */
input[type="number"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgb(220 252 231) !important; /* ring-2 ring-green-100 */
    border-color: rgb(74 222 128) !important; /* border-green-400 */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

/* Custom class for consistent form styling */
.form-input-green:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgb(220 252 231) !important; /* ring-2 ring-green-100 */
    border-color: rgb(74 222 128) !important; /* border-green-400 */
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
}

.no-arrows {
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.no-arrows::-webkit-outer-spin-button,
.no-arrows::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-error {
    border-color: #ef4444 !important; /* red-500 */
    background-color: #fef2f2 !important; /* red-50 */
    box-shadow: 0 0 0 1px #ef4444 !important;
}

.input-error:focus {
    ring-color: #ef4444 !important;
    border-color: #dc2626 !important; /* red-600 */
}

input[type="range"].yellow-range {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--color-bg-medium);
    border-radius: 4px;
    outline: none;
}

input[type="range"].yellow-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

input[type="range"].yellow-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.range-wrapper {
    position: relative;
}

.range-progress {
    position: absolute;
    height: 8px;
    background-color: var(--color-primary);
    border-radius: 4px 0 0 4px;
    pointer-events: none;
    top: 50%;
    transform: translateY(-50%);
    z-index: 0;
}

.yellow-checkbox {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    background-color: var(--color-bg-light);
    cursor: pointer;
    position: relative;
    margin: 0;
    padding: 0;
}

.yellow-checkbox:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.yellow-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}

.yellow-checkbox:checked::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid var(--color-text-white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

@-moz-document url-prefix() {
    .yellow-checkbox:checked::before {
        left: 3px;
        top: 0px;
    }
}

/* --- Tooltip --- */
.tooltip-container {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: fixed;
    width: 250px;
    background-color: var(--color-text-dark);
    color: var(--color-text-white);
    text-align: left;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: var(--z-index-tooltip);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: opacity 0.3s;
    pointer-events: none;
}

.tooltip-container:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* --- Avatar --- */
.avatar-shadow {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.avatar-shadow-without-transition{
    box-shadow: 0 5px 7px -2px rgba(0, 0, 0, 0.1), 0 2px 3px -2px rgba(0, 0, 0, 0.05);
}

/* --- Indicator Images --- */
.indicator-image {
    box-shadow: 
        0 8px 16px -4px rgba(0, 0, 0, 0.1),
        0 4px 8px -2px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.indicator-image:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 12px 20px -4px rgba(0, 0, 0, 0.15),
        0 6px 12px -2px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.avatar-shadow:hover {
    transform: translateY(-2px);
}

.avatar-transition {
    transition: opacity 0.3s ease-in-out;
}

.avatar-overlay-container {
    position: relative;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-video, .avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-image {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 500ms ease-in-out, transform 300ms ease-out;
    transform: scale(0.95);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.avatar-image-visible {
    opacity: 1;
    transform: scale(1);
}

.avatar-overlay-container:hover .avatar-image.avatar-image-visible {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* --- Console / Chat --- */
.console-cursor {
    animation: cursor-blink 1s step-end infinite;
}

.thinking-message {
    font-style: italic;
    color: var(--color-success);
    padding: 4px 0;
    min-height: 1.5em;
    transition: opacity 0.3s ease-out;
    animation: none;
}

.thinking-message:not(:empty) {
    animation: blinking-text 1.5s infinite ease-in-out;
}

.thinking-message:empty {
    opacity: 0;
}

#project-chat-container > div {
    transition: opacity 300ms ease-out;
}

#project-chat-container > .htmx-added {
    opacity: 0;
}

.loading-border {
    border-width: 6px;
    border-style: solid;
    border-color: #FFFFFFCC transparent #FFFFFFCC transparent;
}

/* --- Misc Components --- */
.document-grid {
    /* max-height: 70vh;
    overflow-y: auto; */
}

.artefact-list {
    height: calc(80vh - 40px);
    overflow-y: auto;
}

.project-info-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.project-info-content.expanded {
    max-height: 500px;
}

/* ==========================================================================
   7. Typography & Content Styling (Prose)
   ========================================================================== */
.prose-styling h1, .prose-styling h2, .prose-styling h3, .prose-styling h4, .prose-styling h5, .prose-styling h6 {
    color: var(--color-prose-headings);
    font-weight: 600;
}

.prose-styling h1 {
    font-size: 1.5em;
    margin: 1em 0 0.5em;
}
.prose-styling h2 {
    font-size: 1.3em;
    margin: 1.5em 0 0.75em;
}
.prose-styling h3 {
    font-size: 1.1em;
    margin: 1.25em 0 0.5em;
}
.prose-styling h4 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
}
.prose-styling h5, .prose-styling h6 {
    font-size: 0.875rem;
    margin: 1rem 0 0.25rem;
}

.prose-styling p {
    margin-bottom: 1em;
}

.prose-styling ul, .prose-styling ol {
    margin-left: 1.5em;
    margin-bottom: 1em;
    padding-left: 0; /* Reset browser default */
}

.prose-styling ul { list-style-type: disc; }
.prose-styling ol { list-style-type: decimal; }

.prose-styling li {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.prose-styling a {
    color: var(--color-link);
    text-decoration: none;
}
.prose-styling a:hover {
    text-decoration: underline;
}

/* Applying prose styles to specific containers */
.action-result-content-text,
.custom-text-content,
.modal-artefact-content {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-text-dark);
}

/* Overrides for specific contexts */
.action-result-content-text h2 { color: var(--color-text-medium); }
.action-result-content-text h3 { color: var(--color-text-light); }
.action-result-content-text h4 { color: var(--color-text-dark); }
.action-result-content-text h5 { color: var(--color-text-medium); }
.action-result-content-text h6 { color: var(--color-text-light); }

/* Styles pour les messages utilisateur (maintenant avec bulles bleues) */
.user-message-content p {
    color: #ffffff;
}
.user-message-content ul {
    list-style-type: disc;
    list-style-position: inside;
    margin-left: 0.5rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
}
.user-message-content li {
    color: #ffffff;
    margin-bottom: 0.5rem;
}
.user-message-content ol {
    color: #ffffff;
    list-style-type: decimal;
    list-style-position: inside;
    margin-left: 0.5rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
}
.user-message-content h2 {
    color: #ffffff;
    font-size: 1.3em;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}
.user-message-content h3 {
    color: #ffffff;
    font-size: 1.1em;
    font-weight: 600;
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}

 /* Styles pour les nouveaux messages bot (style simple) */
 .bot-message-simple p {
    color: #374151;
}
.bot-message-simple ul {
    list-style-type: disc;
    list-style-position: inside;
    margin-left: 0.5rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
}
.bot-message-simple li {
    color: #374151;
    margin-bottom: 0.5rem;
}
.bot-message-simple ol {
    color: #374151;
    list-style-type: decimal;
    list-style-position: inside;
    margin-left: 0.5rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
}
.bot-message-simple h2 {
    color: #374151;
    font-size: 1.3em;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}
.bot-message-simple h3 {
    color: #374151;
    font-size: 1.1em;
    font-weight: 600;
    margin-top: 1.25em;
    margin-bottom: 0.5em;
}

/* Slide specific styles */
.slide h1 {
  color: var(--color-text-dark);
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   8. Dashboard
   ========================================================================== */
.app-background {
    background-image: url('/static/images/background.opti.webp');
    background-size: cover;
    background-position: center;
}

.app-content-area {
    height: calc(100vh - 100px);
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 1rem;
    margin: 1rem;
    max-width: calc(100vw - 2rem);
}

/* Optimize content area for medium screens */
@media (min-width: 1001px) and (max-width: 1300px) {
    .app-content-area {
        margin: 1.5rem;
        max-width: calc(100vw - 3rem);
    }
    .dashboard-spacing {
        gap: 1.5rem;
        padding: 2rem;
    }
}

.dashboard-card {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    transition: all 0.3s ease-in-out;
    cursor: pointer;
    border: 1px solid rgba(229, 231, 235, 0.5);
}

.dashboard-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-4px);
}

/* Dashboard layout helpers */
.dashboard-page {
    /* Avoid accidental layout scrollbars on zoom */
    overflow: hidden;
}

.dashboard-spacing {
    gap: 1.25rem;
}

.dashboard-title {
    line-height: 1.1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 1280px; /* similar to max-w-7xl */
    margin-inline: auto;
}

/* Keep cards visually consistent */
.dashboard-grid .dashboard-card {
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Force cards to stay in one row on larger screens */
@media (min-width: 1301px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Medium-large screens - better proportions */
@media (min-width: 1001px) and (max-width: 1300px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
        max-width: 1100px;
    }
    .dashboard-grid .dashboard-card {
        min-height: 170px;
        padding: 1.25rem;
    }
    .avatar-overlay-container { 
        width: 220px; 
        height: 220px; 
    }
    .dashboard-title { 
        font-size: 2.75rem;
    }
}

/* Medium screens - optimize for 800-1000px */
@media (min-width: 801px) and (max-width: 1000px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        max-width: 700px;
    }
    .dashboard-grid .dashboard-card {
        min-height: 160px;
        padding: 1.5rem;
    }
    .avatar-overlay-container { 
        width: 200px; 
        height: 200px; 
    }
    .dashboard-title { 
        font-size: 2.5rem;
    }
}

/* Smaller screens adjustment */
@media (max-width: 800px) and (min-width: 601px) {
    .dashboard-grid {
        gap: 1rem;
        max-width: 600px;
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-grid .dashboard-card {
        min-height: 140px;
        padding: 1rem;
    }
}

/* Remove this redundant media query - covered above */

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        max-width: 400px;
    }
    .dashboard-grid .dashboard-card {
        min-height: 120px;
        padding: 0.75rem;
    }
}

/* Reduce vertical overflow on short viewports and zoomed screens */
@media (max-height: 820px) {
    .app-content-area { height: calc(100vh - 80px); }
    .dashboard-spacing { gap: 1rem; }
    .dashboard-title { font-size: 2.25rem; /* text-4xl */ }
    .avatar-overlay-container { width: 200px; height: 200px; }
}

@media (max-height: 700px) {
    .app-content-area { height: calc(100vh - 64px); }
    .dashboard-title { font-size: 1.875rem; /* text-3xl */ }
    .avatar-overlay-container { width: 140px; height: 140px; }
    .dashboard-grid {
        gap: 0.75rem;
    }
    .dashboard-grid .dashboard-card {
        min-height: 120px;
        padding: 0.75rem;
    }
}

/* High zoom levels - detect by effective viewport size */
@media (max-width: 800px) and (min-width: 481px) {
    /* This catches high zoom on desktop */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
        max-width: 600px;
    }
    .dashboard-grid .dashboard-card {
        min-height: 120px;
        padding: 0.75rem;
    }
    .avatar-overlay-container { 
        width: 160px; 
        height: 160px; 
    }
    .dashboard-title { 
        font-size: 2rem;
    }
}

/* Very high zoom levels or very small screens */
@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
        max-width: 400px;
    }
    .dashboard-grid .dashboard-card {
        min-height: 100px;
        padding: 0.75rem;
    }
    .avatar-overlay-container { 
        width: 120px; 
        height: 120px; 
    }
    .dashboard-title { 
        font-size: 1.75rem;
        height: auto;
        margin-bottom: 0.5rem;
    }
}

/* Very small screens and extreme zoom levels */
@media (max-height: 600px), (max-width: 480px) {
    .app-content-area { 
        height: calc(100vh - 40px);
        margin: 0.5rem;
        border-radius: 0.5rem;
    }
    .dashboard-spacing { 
        gap: 0.5rem;
        padding: 1rem;
    }
    .dashboard-title { 
        font-size: 1.5rem; /* text-2xl */
        height: auto;
        margin-bottom: 0.5rem;
    }
    .avatar-overlay-container { 
        width: 100px; 
        height: 100px; 
    }
    .dashboard-grid {
        gap: 0.5rem;
        max-width: 350px;
        grid-template-columns: 1fr !important;
    }
    .dashboard-grid .dashboard-card {
        min-height: 100px;
        padding: 0.5rem;
    }
    h2 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
}

/* Ultra compact for very constrained screens */
@media (max-height: 500px) {
    .avatar-overlay-container { 
        width: 80px; 
        height: 80px; 
    }
    .dashboard-title { 
        font-size: 1.25rem; /* text-xl */
        height: auto;
        margin-bottom: 0.25rem;
    }
    .dashboard-spacing { 
        gap: 0.25rem;
        padding: 0.5rem;
    }
    h2 {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }
}

/* Extra safety: prevent horizontal scroll caused by transforms on hover */
.dashboard-grid { overflow: hidden; }

/* ==========================================================================
   10. Responsive Indicators Grid
   ========================================================================== */
.indicators-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* Large screens (1600px+) - 4 columns in one row */
@media (min-width: 1600px) {
    .indicators-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }
}

/* Medium-large screens (1301px-1599px) - 4 columns but tighter spacing */
@media (min-width: 1301px) and (max-width: 1599px) {
    .indicators-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
}

/* Medium screens (1001px-1300px) - 2x2 grid */
@media (min-width: 1001px) and (max-width: 1300px) {
    .indicators-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Small-medium screens (801px-1000px) - 2x2 grid with smaller gap */
@media (min-width: 801px) and (max-width: 1000px) {
    .indicators-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Small screens (601px-800px) - 2x2 grid, compact */
@media (min-width: 601px) and (max-width: 800px) {
    .indicators-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
}

/* Mobile screens (≤600px) - single column */
@media (max-width: 600px) {
    .indicators-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* Responsive adjustments for indicator cards */
@media (max-width: 1300px) {
    .indicators-grid .indicator-image {
        width: 4rem; /* w-16 */
        height: 4rem; /* h-16 */
    }
}

@media (max-width: 800px) {
    .indicators-grid .indicator-image {
        width: 3rem; /* w-12 */
        height: 3rem; /* h-12 */
    }
    
    /* Reduce padding on smaller screens */
    .indicators-grid > div {
        padding: 1rem !important; /* p-4 instead of p-6 */
    }
}

@media (max-width: 600px) {
    .indicators-grid .indicator-image {
        width: 2.5rem; /* w-10 */
        height: 2.5rem; /* h-10 */
    }
    
    /* Further reduce padding on mobile */
    .indicators-grid > div {
        padding: 0.75rem !important; /* p-3 */
    }
}

/* ==========================================================================
   9. Sidebar Project List Scroll
   ========================================================================== */
.project-list-scroll {
    /* Limit height to approximately 5 project items */
    max-height: 200px; /* Assuming ~40px per project item */
    overflow-y: auto;
    overflow-x: hidden;
    /* Smooth scrolling */
    scroll-behavior: smooth;
}

/* Custom scrollbar styling for project list */
.project-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.project-list-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.project-list-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
    transition: background 0.3s ease;
}

.project-list-scroll::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Firefox scrollbar styling */
.project-list-scroll {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

/* Add subtle fade effect at bottom when scrollable */
.project-list-scroll::after {
    content: '';
    position: sticky;
    bottom: 0;
    display: block;
    height: 8px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.8));
    pointer-events: none;
}

/* ==========================================================================
   11. Copilot Interview
   ========================================================================== */

@keyframes pulse-glow {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.5; }
    50% { transform: translate(-5%, -5%) scale(1.1); opacity: 0.8; }
}

/* Bubble & 3D */
.bubble {
    cursor: pointer;
    transition: all 0.3s ease;
}
.bubble-text {
    pointer-events: none;
    user-select: none;
}
.node-3d {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tooltip */
.tooltip-bubble {
    position: absolute;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.95);
    color: white;
    border-radius: 8px;
    font-size: 13px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    max-width: 250px;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.tooltip-bubble.active {
    opacity: 1;
}

/* Visualization Container */
#bubble-container {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
#bubble-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.15) 0%, transparent 70%);
    pointer-events: none;
    animation: pulse-glow 8s ease-in-out infinite;
}

/* Interview Header */
.interview-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* Detail Panel */
.detail-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Expected Elements */
.expected-elements ul {
    list-style-type: disc;
    margin-left: 1rem;
    margin-bottom: 0.5rem;
}

.expected-elements li {
    font-size: 0.75rem;
    line-height: 1.25rem;
    margin-bottom: 0.25rem;
    padding-left: 0.25rem;
}

/* Question Card */
.question-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(229, 231, 235, 0.5);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}
.question-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Input Styles for Interview Page */
.interview-input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 100%);
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}
.interview-input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-success) 0%, #15803d 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4);
    transition: all 0.2s ease;
}
.interview-input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.6);
}
.interview-input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-success) 0%, #15803d 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4);
}

.interview-textarea, .interview-input[type="text"] {
    transition: all 0.3s ease;
}
.interview-textarea:focus, .interview-input[type="text"]:focus {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3) !important;
}

/* Free Notes Panel */
.free-notes-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(254, 252, 232, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
}
.free-notes-panel.active {
    max-height: 200px;
}

/* Reset Button */
.reset-btn {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}
.reset-btn:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateX(-2px);
}

/* Empty State */
.empty-state {
    background: linear-gradient(135deg, rgba(249, 250, 251, 0.8) 0%, rgba(243, 244, 246, 0.8) 100%);
}

/* Badge */
.badge-elegant {
    background: linear-gradient(135deg, var(--color-primary) 0%, #d97706 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Stats Cards */
.stat-card {
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}