/* main.css */

:root {
    /* General Variables (Assigned to Dark Theme by Default) */
    --bg-deep-space: #020412;
    --text-primary: #E6F1FF;
    --text-secondary: #8A94A4;
    --glass-bg: rgba(10, 15, 30, 0.75);
    --glass-border: rgba(0, 246, 255, 0.15);
    --accent-cyan: #00F6FF;
    --accent-magenta: #E228FF;
    --accent-blue-deep: #3D44F9;
    --link-hover: #00F6FF;
    --product-border-magenta: rgba(226, 40, 255, 0.2);
    --product-border-cyan: rgba(0, 123, 255, 0.3);
    --chat-bubble-bg: #3A2D4F; /* ADDED */
}

body[data-theme="light"] {
    /* Light Theme Overrides */
    --bg-deep-space: #F0F2F5;
    --text-primary: #0A0F1A;
    --text-secondary: #4A5568;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(59, 130, 246, 0.3);
    --accent-cyan: #007BFF;
    --accent-magenta: #9D30FF;
    --accent-blue-deep: #2a30cc;
    --link-hover: #3D8BFF;
    --product-border-magenta: rgba(157, 48, 255, 0.3);
    --product-border-cyan: rgba(0, 123, 255, 0.3);
    --chat-bubble-bg: #EAE6F3; /* ADDED */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-deep-space);
    color: var(--text-primary);
    overflow-x: hidden;
    cursor: none;
    transition: background-color 0.5s ease, color 0.5s ease;
}

.font-sora {
    font-family: 'Sora', sans-serif;
}

/* Custom Cursor */
.cursor-dot, .cursor-outline {
    pointer-events: none;
    position: fixed;
    border-radius: 50%;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, background-color 0.3s ease, border-color 0.3s ease, width 0.2s ease, height 0.2s ease, transform 0.05s linear;
    left: 0;
    top: 0;
}
.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-cyan);
}
.cursor-outline {
    width: 40px;
    height: 40px;
    border: 2px solid var(--accent-cyan);
}
body:hover .cursor-dot, body:hover .cursor-outline {
    opacity: 1;
}
.cursor-interact .cursor-outline {
    transform: scale(1.5) translate(-50%, -50%);
}
.cursor-text-interact .cursor-dot {
    transform: scale(0) translate(-50%, -50%);
}
.cursor-text-interact .cursor-outline {
    width: 60px;
    height: 60px;
    border-width: 1px;
    transform: scale(1) translate(-50%, -50%);
}

/* Holographic Gradients & Glows */
.holographic-text {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta), var(--accent-blue-deep));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    animation: holographic-shine 8s linear infinite;
    background-size: 200% 200%;
    transition: background 0.5s ease;
}

.holographic-border {
    border: 1px solid;
    border-image-source: linear-gradient(90deg, var(--accent-cyan), var(--accent-magenta));
    border-image-slice: 1;
    transition: border-image-source 0.5s ease;
}

.connect-button-text {
    color: var(--bg-deep-space);
    transition: color 0.5s ease;
}

.connect-link-text {
     color: var(--text-primary);
}

.cyan-glow {
    box-shadow: 0 0 15px var(--accent-cyan), 0 0 30px var(--accent-cyan), 0 0 45px color-mix(in srgb, var(--accent-cyan) 50%, transparent);
    transition: box-shadow 0.5s ease;
}
.magenta-glow {
    filter: drop-shadow(0 0 15px var(--accent-magenta));
    transition: filter 0.5s ease;
}

@keyframes holographic-shine {
    to {
        background-position: 200% center;
    }
}

/* Animations & Reveals */
@keyframes text-mask-reveal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.text-reveal-mask {
    display: block;
    overflow: hidden;
}
.text-reveal-mask .line {
    display: block;
    transform: translateY(100%);
    animation: text-mask-reveal 1.2s cubic-bezier(0.76, 0, 0.24, 1) forwards;
}
.reveal-on-scroll {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(60px) scale(0.95);
    transition: opacity 1.2s cubic-bezier(0.165, 0.84, 0.44, 1), transform 1.2s cubic-bezier(0.165, 0.84, 0.44, 1), filter 1.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.reveal-on-scroll.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
}

/* Components */
.nav-link {
    color: var(--text-secondary);
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative;
    padding-bottom: 4px;
}
.nav-link:hover {
    color: var(--link-hover);
    transform: translateY(-2px);
}

/* AidDATA link styling */
.aiddata-footer-link {
    font-size: 1.1em; /* Base size for the AidDATA text */
    transition: color 0.3s ease, font-size 0.3s ease; /* Smooth transition for color and size */
}

.aiddata-footer-link:hover,
.aiddata-footer-link:active {
    color: var(--accent-blue-deep); /* Changes color to deep blue on hover/click */
    font-size: 1.2em; /* Slightly increases size on hover/click for emphasis */
}

/* --- Layout Classes for Chat Pages (Ensuring Sidebar Content is Visible and Scrollable) --- */
@media (min-width: 768px) { /* Medium devices and up */
    .chat-page-sidebar-md {
        flex: 0 0 30%; /* Don't grow, don't shrink, base size is 30% */
        max-width: 20rem; /* Cap sidebar width */
        display: flex;
        flex-direction: column;
    }

    .chat-page-content-md {
        flex-grow: 1;
        width: 100%; /* Establish a basis that can shrink to fit remaining space */
        min-width: 0; /* Allow shrinking below content's intrinsic size */
    }
}

@media (min-width: 1024px) { /* Large devices and up */
    .chat-page-sidebar-lg {
        flex-basis: 18rem; /* On large screens, use a fixed width */
    }
}


/* Adjust top margin for the chat content (ensure it's not negatively affected) */
.chat-page-content-md {
    margin-top: 0; /* Ensure no unnecessary top margin */
}

/* Ensure input field within chat section takes available width, but doesn't cause overflow */
.chat-input-wrapper {
    display: flex;
    align-items: center;
    width: 100%; /* Ensure the wrapper takes full width of its parent */
}

.chat-input-wrapper input {
    flex-grow: 1; /* Input takes up available space */
    min-width: 0; /* Allows the input to shrink if needed, preventing overflow */
    /* max-width is handled directly in HTML for better control with Tailwind (max-w-full) */
}

/* Ensure buttons don't shrink and chatbox content handles overflow */
.chat-input-wrapper button {
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

#chatbox, #chatboxVoiced {
    overflow-x: hidden; /* Prevent horizontal scroll within chat messages */
    word-wrap: break-word; /* Break long words */
}

/* === ADDED START === */
.ai-message {
    background-color: var(--chat-bubble-bg);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    max-width: 85%;
    align-self: flex-start; /* Aligns AI messages to the left */
    word-wrap: break-word;
    transition: background-color 0.5s ease, color 0.5s ease;
    margin-bottom: 0.5rem; /* Adds a little space between messages */
}
/* === ADDED END === */

/* --- Scrollbar Hiding for Course Content Sidebar (Re-enabled for visibility, then hide) --- */
/* Target the specific container for the course content that has overflow-y-auto */
#course-content-panel {
    /* Ensure overflow-y-auto is active to allow scrolling */
    overflow-y: auto; /* Make sure this is explicitly set if it was overridden */
    /* Adjust padding-bottom if content is being cut off at the bottom of the visible area */
    padding-bottom: 2rem; /* Add some extra padding at the bottom of the scrollable area */

    /* Hide scrollbar for Firefox */
    scrollbar-width: none;
}

/* Hide scrollbar for Webkit browsers (Chrome, Safari) */
#course-content-panel::-webkit-scrollbar {
    display: none;
    width: 0; /* Ensures no space is taken by the vertical scrollbar */
    height: 0; /* Ensures no space is taken by horizontal scrollbar if it appeared */
}


/* Styling for the clickable follow-up questions generated by the AI */
.follow-up-question {
  display: block; /* Makes each question appear on its own line */
  padding: 4px 8px; /* Adds a little clickable space around the text */
  margin-bottom: 0.5rem; /* (8px) Adds space between each question */
  color: var(--text-secondary); /* Uses the theme's secondary text color */
  text-decoration: none; /* Removes the default link underline */
  border-radius: 6px; /* Gives the links slightly rounded corners */
  transition: all 0.2s ease-in-out; /* Smooth transition for hover effects */
}

.follow-up-question:hover {
  color: var(--accent-cyan); /* Changes color on hover to your theme's accent color */
  background-color: rgba(255, 255, 255, 0.05); /* Adds a subtle background glow on hover */
}

/* === STYLES MOVED FROM PREFERENCES.HTML === */
.form-step {
    display: none;
}
.form-step.active-step {
    display: block;
}
.progress-bar-fill {
    transition: width 0.4s ease-in-out;
}
.bg-accent-cyan {
    background-color: var(--accent-cyan);
}

.chat-container-height {
  height: calc(100vh - 10rem); /* Full screen height minus header/padding */
}

/* === NEW STYLE FOR INACTIVE COURSE SUBJECTS === */
.inactive-subject {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}


/* main.css */

/* ... other styles ... */


/* === LANGUAGE SELECTOR STYLES === */

.language-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: 'Sora', sans-serif;
    font-size: 0.875rem; /* 14px */
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 9999px; /* rounded-full */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.language-search-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-cyan) 30%, transparent);
}

.language-search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* MODIFIED: Renamed to be more generic for reuse */
.language-options-container {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem; /* 12px */
    z-index: 10;
    padding: 0.25rem; /* Add a little padding around the items */
}

#language-options-list {
    max-height: 15rem; /* 240px */
    overflow-y: auto;
}

/* MODIFIED: Renamed to be more generic for reuse */
.language-option-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem; /* 14px */
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-radius: 0.375rem; /* 6px */
    text-align: left;
    width: 100%;
    display: block;
}

.language-option-item:hover {
    background-color: var(--accent-cyan);
    color: var(--bg-deep-space); /* Make text dark on hover for contrast */
}

/* Hide scrollbar for the language dropdown list */
#language-options-list::-webkit-scrollbar {
    display: none; /* For Chrome, Safari, and Opera */
}
#language-options-list {
  -ms-overflow-style: none;  /* For IE and Edge */
  scrollbar-width: none;  /* For Firefox */
}

/* === STYLES MOVED FROM PREFERENCES.HTML (NEW) === */
select option:disabled {
    color: #6b7280;
    background-color: #374151;
}

.language-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    background-color: var(--glass-bg);
    /* Hide scrollbar for Firefox */
    scrollbar-width: none;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.language-search-results::-webkit-scrollbar {
    display: none;
}

.language-search-item {
    padding: 0.75rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.2s ease;
}

.language-search-item:hover {
    background-color: color-mix(in srgb, var(--accent-cyan) 20%, transparent);
}

/* Hide scrollbars where we use overflow-x-auto */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
