/* style.css - Phase 1 Foundation */

/* --- Reset & Base Styles --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px; /* Base font size for rem units */
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Professional, readable sans-serif, Inter preferred */
  line-height: 1.6;
  color: var(--color-text-primary);
  background-color: var(--color-background);
  padding: 0; /* Remove default padding, handle with header/main/footer */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased; /* Improve font rendering */
  -moz-osx-font-smoothing: grayscale;
}

/* --- Color Palette (CSS Variables) --- */
:root {
  --color-primary: #005f73;    /* Dark Blue/Teal - Trust, Professionalism */
  --color-secondary: #0a9396;  /* Medium Teal/Green - Support, Guidance */
  --color-accent: #94d2bd;     /* Light Teal/Green - Calm, Highlights */
  --color-background: #f8f9fa; /* Very Light Gray/Off-white - Clean, Minimal */
  --color-surface: #ffffff;    /* White for cards/modals - Clean */
  --color-text-primary: #212529; /* Dark Gray - Readability */
  --color-text-secondary: #495057; /* Medium Gray - Secondary info */
  --color-border: #dee2e6;     /* Light Gray Border - Subtle separation */
  --color-success: #2a9d8f;    /* Green for success states - Positive feedback */
  --color-warning: #e9c46a;    /* Yellow for warnings/disclaimers - Caution */
  --color-error: #e76f51;      /* Red/Orange for errors - Attention */
  --color-link: var(--color-primary);
  --color-link-hover: #003f4f; /* Darker primary */
  --color-ai-message-bg: var(--color-surface); /* AI messages on surface color */
  --color-user-message-bg: #e0f7fa; /* Light cyan background for user messages - Distinction */
  --color-disabled: #adb5bd; /* Gray for disabled elements */
  --color-disabled-bg: #e9ecef;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.375rem;
  --border-radius-lg: 0.5rem;
  --transition-base: all 0.2s ease-in-out;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 0.75rem;
  font-weight: 600; /* Slightly bolder */
  line-height: 1.3;
  color: var(--color-primary); /* Use primary color for headings */
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: var(--transition-base);
}

a:hover, a:focus {
  color: var(--color-link-hover);
  text-decoration: underline;
}

strong {
    font-weight: 600;
}

/* --- Layout --- */
.container { /* Optional container for centering content */
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  width: 100%;
}

header {
    background-color: var(--color-surface);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    position: sticky; /* Keep header visible */
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-container img {
    height: 40px;
    width: auto; /* Maintain aspect ratio */
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0; /* Reset margin */
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 1rem;
    margin: 0.5rem 0; /* Add some margin for wrapping */
    padding: 0; /* Reset padding */
}

header nav a {
    text-decoration: none;
    color: var(--color-text-secondary);
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-base);
}

header nav a:hover, header nav a:focus, header nav a.active { /* Add .active class via JS */
    color: var(--color-primary);
    background-color: var(--color-background);
    text-decoration: none;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-switcher button {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-base);
}
.language-switcher button:hover, .language-switcher button:focus {
    color: var(--color-primary);
}
.language-switcher button.active,
.language-switcher button[aria-pressed="true"] { /* Style active language */
    color: var(--color-primary);
    font-weight: 700;
}

.user-auth a {
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-base);
}
.user-auth a:hover, .user-auth a:focus {
    color: var(--color-primary);
    background-color: var(--color-background);
    text-decoration: none;
}

main {
    flex-grow: 1; /* Ensure main content takes available space */
    padding: 1.5rem 1rem; /* Padding for main content area */
}

main > section {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background-color: var(--color-surface);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
}
main > section:last-of-type {
    margin-bottom: 0; /* Remove margin from last section */
}

footer {
    background-color: var(--color-background);
    color: var(--color-text-secondary);
    padding: 1.5rem 1rem;
    text-align: center;
    border-top: 1px solid var(--color-border);
    font-size: 0.9rem;
}

footer nav ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 1rem 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

footer nav a {
    color: var(--color-text-secondary);
}
footer nav a:hover, footer nav a:focus {
    color: var(--color-primary);
}

/* --- Basic Components --- */
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  display: inline-flex; /* Use flex for icon alignment */
  align-items: center;
  justify-content: center;
  gap: 0.5rem; /* Space between icon and text */
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  font-weight: 600; /* Increased weight for contrast */
  line-height: 1.5;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-base);
  color: #fff;
  background-color: var(--color-secondary);
  border-color: var(--color-secondary);
}

button i,
input[type="button"] i,
input[type="submit"] i,
input[type="reset"] i {
    line-height: 1; /* Prevent icon from affecting button height */
    /* font-size: 1em; /* Adjust if needed */
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  background-color: #087a7d; /* Darker secondary */
  border-color: #087a7d;
  text-decoration: none; /* Remove underline on hover for buttons */
  color: #fff; /* Ensure text remains white */
}

button:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
input[type="reset"]:focus {
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(10, 147, 150, 0.5); /* Focus ring using secondary color */
}

button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
input[type="reset"]:disabled {
    background-color: var(--color-disabled-bg);
    border-color: var(--color-disabled-bg);
    color: var(--color-disabled);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Secondary button style */
.button-secondary {
    background-color: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    font-weight: 500; /* Lighter weight for secondary */
}
.button-secondary:hover {
    background-color: var(--color-background);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}
.button-secondary:focus {
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5); /* Gray focus ring */
}

/* Basic input styling */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit; /* Ensure inputs use body font */
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-surface);
  background-clip: padding-box;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  margin-bottom: 1rem; /* Add some space below inputs */
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--color-accent);
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(148, 210, 189, 0.5); /* Focus ring using accent color */
}

textarea {
    min-height: 80px;
    resize: vertical; /* Allow vertical resize */
}

/* --- Accessibility --- */
/* Ensure visible focus styles for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 95, 115, 0.3); /* Optional enhanced focus shadow */
    border-radius: var(--border-radius-sm); /* Ensure radius matches element */
}
/* Remove default outline when focus-visible is supported and applied */
*:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Hide content visually but keep it accessible to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Hide button text visually, keep icon (use with sr-only on text span if needed) */
.icon-only .button-text {
    /* Example: Hide text on small screens */
    /* position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; */
}

/* --- Disclaimer Styling --- */
.disclaimer {
    background-color: rgba(233, 196, 106, 0.15); /* Light warning background */
    color: var(--color-text-secondary);
    border-left: 4px solid var(--color-warning);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.disclaimer strong {
    color: var(--color-text-primary); /* Ensure strong text has good contrast */
}

.disclaimer-inline {
    display: block; /* Make it block for spacing */
    font-size: 0.8rem;
    font-style: italic;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

/* Footer disclaimer */
footer .disclaimer {
    background-color: transparent;
    border-left: none;
    border-top: 2px solid var(--color-warning);
    padding-top: 1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    border-radius: 0;
}

/* --- Feature Specific Styles --- */

/* Welcome Section */
#welcome {
    background-color: var(--color-accent); /* Use accent for welcome */
    color: var(--color-text-primary); /* Improved contrast */
}
#welcome h2 {
    color: var(--color-text-primary); /* Use text primary for better contrast on accent */
}
#welcome .disclaimer {
    background-color: rgba(255, 255, 255, 0.5); /* Lighter disclaimer on accent bg */
    border-color: var(--color-primary);
    color: var(--color-text-primary); /* Ensure text contrast */
}

/* AI Assistant */
.chat-interface {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    display: flex;
    flex-direction: column;
    height: 400px; /* Example fixed height */
    background-color: var(--color-background);
    margin-bottom: 1rem;
    overflow: hidden; /* Contain children */
    box-shadow: var(--shadow-sm);
}

.chat-log {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Custom scrollbar (optional) */
    scrollbar-width: thin;
    scrollbar-color: var(--color-accent) var(--color-background);
}
.chat-log::-webkit-scrollbar {
    width: 8px;
}
.chat-log::-webkit-scrollbar-track {
    background: var(--color-background);
    border-radius: 4px;
}
.chat-log::-webkit-scrollbar-thumb {
    background-color: var(--color-accent);
    border-radius: 4px;
    border: 2px solid var(--color-background);
}


.message {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-lg); /* Slightly larger radius for messages */
    max-width: 80%;
    line-height: 1.4;
    box-shadow: var(--shadow-sm);
    word-wrap: break-word; /* Prevent long words from overflowing */
    position: relative; /* For potential timestamp positioning */
}

.message p {
    margin-bottom: 0.25rem; /* Reduce margin inside messages */
}
.message p:last-child {
    margin-bottom: 0;
}

.ai-message {
    background-color: var(--color-ai-message-bg);
    border: 1px solid var(--color-border);
    align-self: flex-start;
    margin-right: auto; /* Push to left */
}

.user-message { /* Add this class via JS when displaying user messages */
    background-color: var(--color-user-message-bg);
    border: 1px solid var(--color-accent);
    align-self: flex-end;
    margin-left: auto; /* Push to right */
    color: var(--color-text-primary);
}

.message-type {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-secondary);
    display: inline-block;
    margin-bottom: 0.25rem;
    padding: 0.1rem 0.4rem;
    background-color: rgba(10, 147, 150, 0.1);
    border-radius: var(--border-radius-sm);
}

.message .source-link {
    font-size: 0.8rem;
    margin-left: 0.5rem;
    color: var(--color-text-secondary);
    text-decoration: underline;
}
.message .source-link:hover {
    color: var(--color-primary);
}

/* AI Typing Indicator */
.loading-indicator {
    padding: 0.5rem 1rem; /* Smaller padding */
    opacity: 0.8;
}
.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--color-text-secondary);
    border-radius: 50%;
    margin: 0 2px;
    animation: dot-bounce 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

.chat-input {
    display: flex;
    padding: 0.75rem;
    border-top: 1px solid var(--color-border);
    background-color: var(--color-surface);
    gap: 0.5rem;
    align-items: flex-end; /* Align items to bottom */
}

.chat-input textarea {
    flex-grow: 1;
    margin-bottom: 0; /* Remove default margin */
    min-height: 40px; /* Adjust initial height */
    max-height: 120px; /* Limit growth */
    height: 40px; /* Start small, resize allowed */
    overflow-y: auto; /* Add scroll if needed */
    border-radius: var(--border-radius-sm); /* Ensure consistent radius */
}

.chat-input button {
    flex-shrink: 0; /* Prevent buttons from shrinking */
    height: 40px; /* Match textarea initial height */
    padding: 0.5rem 1rem; /* Adjust padding */
    align-self: flex-end; /* Align button to bottom with textarea */
}

#copy-response-btn {
    background-color: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    height: 40px;
    padding: 0.5rem 0.8rem;
}
#copy-response-btn:hover {
    background-color: var(--color-background);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

/* Interview Prep */
.interview-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

#start-recording-btn, #stop-recording-btn {
    /* Icons are handled by Font Awesome in HTML */
}

#stop-recording-btn {
    background-color: var(--color-error);
    border-color: var(--color-error);
    font-weight: 600; /* Ensure contrast */
}
#stop-recording-btn:hover {
    background-color: #d0563a; /* Darker error */
    border-color: #d0563a;
}
#stop-recording-btn:disabled {
    background-color: var(--color-disabled-bg);
    border-color: var(--color-disabled-bg);
    color: var(--color-disabled);
}

#waveform-placeholder {
    flex-basis: 100%; /* Take full width when wrapped */
    height: 60px;
    background-color: var(--color-background);
    border: 1px dashed var(--color-border);
    border-radius: var(--border-radius-sm);
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-style: italic;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
#waveform-placeholder i {
    margin-right: 0.5rem;
}

#waveform-placeholder.recording {
    font-style: normal;
    color: var(--color-primary);
    border-color: var(--color-secondary);
    animation: pulse 1.5s infinite ease-in-out;
}
/* Add style for processing state if needed (JS currently changes text) */
#waveform-placeholder.processing {
    font-style: normal;
    color: var(--color-primary);
    border-color: var(--color-accent);
    background-color: var(--color-background); /* Static background */
    /* Add a spinner or different icon? */
}

@keyframes pulse {
  0% { background-color: var(--color-background); }
  50% { background-color: var(--color-user-message-bg); } /* Light user message color */
  100% { background-color: var(--color-background); }
}

#audio-playback {
    margin-top: 1rem;
    width: 100%;
    display: block; /* Ensure it takes width */
}
/* Style default audio controls slightly */
#audio-playback::-webkit-media-controls-panel {
    background-color: var(--color-background);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
    border: 1px solid var(--color-border);
}
#audio-playback::-webkit-media-controls-play-button,
#audio-playback::-webkit-media-controls-mute-button {
    background-color: var(--color-secondary);
    border-radius: 50%;
    color: white; /* Ensure icon visibility */
}
#audio-playback::-webkit-media-controls-current-time-display,
#audio-playback::-webkit-media-controls-time-remaining-display {
    color: var(--color-text-primary);
    font-size: 0.9rem;
}
#audio-playback::-webkit-media-controls-timeline {
    background-color: var(--color-border);
    border-radius: 4px;
    height: 6px;
}
#audio-playback::-webkit-media-controls-volume-slider {
     background-color: var(--color-border);
     border-radius: 4px;
     height: 6px;
}


.interview-feedback {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--color-background);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
}
.interview-feedback h3 {
    margin-bottom: 0.5rem;
    color: var(--color-secondary);
}

/* Study Academy */
.modules-container {
    display: grid;
    gap: 1.5rem;
}

.module {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 1rem 1.5rem;
    background-color: var(--color-surface); /* Ensure background */
    box-shadow: var(--shadow-sm);
}

.module h3 {
    margin-bottom: 1rem;
    color: var(--color-secondary);
}

.module ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.module li {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space out content and status */
    gap: 0.75rem;
    padding: 0.75rem 0.5rem; /* Add padding for hover */
    border-bottom: 1px solid var(--color-background);
    transition: var(--transition-base);
    border-radius: var(--border-radius-sm);
    cursor: pointer; /* Indicate interactivity */
}
.module li:last-child {
    border-bottom: none;
}
.module li:hover, .module li:focus-within { /* Focus-within for keyboard nav */
    background-color: var(--color-background);
}
/* Add focus style directly to li if it becomes focusable via JS */
.module li:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px; /* Inset outline */
    background-color: var(--color-background);
}


.lesson-content {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden; /* Prevent long titles from breaking layout */
}

.lesson-title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text-primary); /* Ensure readability */
}

.lesson-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0; /* Prevent shrinking */
}

.status-icon {
    display: inline-flex; /* Use flex for centering */
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    line-height: 1; /* Remove extra line height */
    text-align: center;
    border-radius: 50%;
    font-size: 0.8rem; /* Slightly smaller icon */
    color: var(--color-surface);
    flex-shrink: 0;
    background-color: var(--color-border); /* Default: Not started */
}
.status-icon i {
    line-height: 1; /* Ensure icon is centered */
    vertical-align: middle;
}

/* Status Styles */
.status-icon.in-progress {
    background-color: var(--color-warning);
    color: var(--color-text-primary); /* Better contrast on yellow */
}
.status-icon.completed {
    background-color: var(--color-success);
}
.status-icon.not-started {
    background-color: var(--color-border);
    color: var(--color-text-secondary); /* Icon color for not started */
}
/* Font Awesome icons are used in HTML, no need for ::before */


progress {
    width: 80px; /* Example fixed width */
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    border: none; /* Remove default border */
    background-color: var(--color-background); /* Track color */
    appearance: none; /* Override default look */
    -webkit-appearance: none;
    -moz-appearance: none;
    vertical-align: middle; /* Align with text */
    flex-shrink: 0;
}

/* Style the progress bar value */
progress::-webkit-progress-bar {
    background-color: var(--color-background);
    border-radius: 4px;
}
progress::-webkit-progress-value {
    background-color: var(--color-accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}
progress::-moz-progress-bar { /* Firefox */
    background-color: var(--color-accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Referral System */
.referral-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    background-color: var(--color-background);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid var(--color-border);
}
.referral-info p {
    margin-bottom: 0; /* Remove margin from p inside flex */
    flex-grow: 1;
    flex-basis: 100%; /* Allow text to take full width initially */
}
#referral-code {
    font-family: monospace;
    font-size: 1.1rem;
    background-color: var(--color-surface);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    color: var(--color-primary);
    font-weight: bold;
    margin-right: 0.5rem; /* Space before copy button */
    display: inline-block; /* Ensure it doesn't break line unnecessarily */
}
#copy-referral-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.share-buttons {
    display: flex;
    gap: 0.5rem;
    flex-basis: 100%; /* Take full width when wrapped */
    margin-top: 0.5rem; /* Add space when wrapped */
}
.share-buttons button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}
.share-buttons button:hover {
    background-color: var(--color-background);
    color: var(--color-text-primary);
}

.referral-tracking {
    background-color: var(--color-background);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
}
.referral-tracking h3 {
    margin-bottom: 0.5rem;
    color: var(--color-secondary);
}
.referral-tracking p {
    margin-bottom: 0.5rem;
}
.referral-tracking p:last-child {
    margin-bottom: 0;
}

/* User Profile */
#profile {
    /* Basic styling, can be enhanced */
}
/* Note: Initial hiding is done via d-none class */
.profile-details div,
.profile-progress div {
    margin-bottom: 0.75rem;
    line-height: 1.8; /* Improve spacing with buttons */
}
#profile button {
    margin-left: 0.75rem;
    padding: 0.2rem 0.6rem;
    font-size: 0.85rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    vertical-align: middle;
}
#profile button:hover {
    background-color: var(--color-background);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}
#profile h3 {
    margin-top: 1.5rem;
    color: var(--color-secondary);
    border-top: 1px solid var(--color-border);
    padding-top: 1rem;
}

/* --- Loading, Error, Empty States --- */
.loading-spinner {
    border: 4px solid var(--color-background); /* Light grey */
    border-top: 4px solid var(--color-secondary); /* Blue */
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 2rem auto; /* Center spinner */
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-message {
    color: var(--color-error);
    background-color: rgba(231, 111, 81, 0.1);
    border: 1px solid var(--color-error);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    margin: 1rem 0;
}

.empty-state, /* Original class */
.empty-state-message /* Class used in HTML */ {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 2rem 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--border-radius-sm);
    margin: 1rem 0;
    background-color: var(--color-background);
}
.empty-state p,
.empty-state-message p {
    margin-bottom: 0.5rem;
}
.empty-state strong,
.empty-state-message strong { /* Guide text */
    display: block;
    margin-top: 0.5rem;
    color: var(--color-secondary);
    font-weight: 500; /* Less strong than default */
}


/* --- Responsive Design (Mobile First) --- */

/* Styles above are mobile-first */

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  html {
    font-size: 17px; /* Slightly larger base font on larger screens */
  }
  h1 { font-size: 2.75rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.75rem; }

  header {
      padding: 1rem 1.5rem;
      flex-wrap: nowrap; /* Prevent wrapping on larger screens */
  }
  header nav ul {
      margin: 0; /* Reset margin */
      gap: 1.5rem;
  }
  main {
      padding: 2rem 1.5rem;
  }
  main > section {
      padding: 2rem;
      border-radius: var(--border-radius-lg); /* Slightly larger radius */
  }
  footer {
      padding: 2rem 1.5rem;
  }
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  .chat-interface {
      height: 450px; /* Slightly taller chat */
  }
  .message {
      max-width: 70%;
  }
  .modules-container {
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Grid layout for modules */
  }
  .referral-info {
      padding: 1.5rem;
      flex-wrap: nowrap; /* Prevent wrapping on larger screens */
  }
  .referral-info p {
      flex-basis: auto; /* Allow text to shrink */
  }
  .share-buttons {
      flex-basis: auto;
      margin-top: 0;
  }
  .referral-tracking {
      padding: 1.5rem;
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  html {
    font-size: 18px;
  }
   h1 { font-size: 3rem; }

   header {
       padding: 1rem 2rem;
   }
   main {
       padding: 2.5rem 2rem;
   }
   footer {
       padding: 2rem 2rem;
   }
   .container {
       padding-left: 2rem;
       padding-right: 2rem;
   }
   .chat-interface {
      height: 500px; /* Even taller chat */
  }
  .message {
      max-width: 65%;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto; /* Disable smooth scrolling */
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  #waveform-placeholder.recording {
      animation: none; /* Disable pulsing */
      background-color: var(--color-user-message-bg); /* Static background when recording */
  }
  .loading-dots span {
      animation: none;
      opacity: 1; /* Keep dots visible */
  }
}


/* --- Utility Classes --- */
.text-center { text-align: center !important; }
.mt-1 { margin-top: 1rem !important; }
.mb-1 { margin-bottom: 1rem !important; }
.mt-2 { margin-top: 2rem !important; }
.mb-2 { margin-bottom: 2rem !important; }
.p-1 { padding: 1rem !important; }
.p-2 { padding: 2rem !important; }
.bg-surface { background-color: var(--color-surface) !important; }
.rounded { border-radius: var(--border-radius-sm) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.d-none { display: none !important; } /* Utility to hide elements */