:root {
  --font-family: "Roboto", sans-serif;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1),
    0 4px 6px -4px rgb(0 0 0 / 0.1);
  --brand-color: #4f46e5;
  --brand-color-hover: #4338ca;
}

body[data-theme="light"] {
  --primary-color: #4f46e5;
  --primary-color-hover: #4338ca;
  --background-color: #f3f4f6;
  --surface-color: #ffffff;
  --surface-color-2: #f9fafb;
  --text-color: #1f2937;
  --muted-text-color: #6b7280;
  --border-color: #e5e7eb;
  --user-message-bg: #e0e7ff;
  --model-message-bg: #f9fafb;
  --error-bg: #fee2e2;
  --error-border: #fca5a5;
  --error-text: #b91c1c;
  --modal-overlay-bg: rgba(17, 24, 39, 0.6);
  --suggestion-bg: #e5e7eb;
  --suggestion-bg-hover: #d1d5db;
  --suggestion-text: #4b5563;
  --lang-button-active-bg: var(--primary-color);
  --lang-button-active-text: #ffffff;
}

body[data-theme="dark"] {
  --primary-color: #818cf8;
  --primary-color-hover: #a78bfa;
  --background-color: #111827;
  --surface-color: #1f2937;
  --surface-color-2: #111827;
  --text-color: #f3f4f6;
  --muted-text-color: #9ca3af;
  --border-color: #374151;
  --user-message-bg: #3730a3;
  --model-message-bg: #374151;
  --error-bg: #5f2120;
  --error-border: #b91c1c;
  --error-text: #fecaca;
  --modal-overlay-bg: rgba(0, 0, 0, 0.7);
  --suggestion-bg: #4b5563;
  --suggestion-bg-hover: #6b7280;
  --suggestion-text: #e5e7eb;
  --lang-button-active-bg: var(--primary-color);
  --lang-button-active-text: #e5e7eb;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body,
#app {
  height: 100%;
  width: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.2s, color 0.2s;
  overflow: hidden; /* Prevent body scroll with dual pane */
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: var(--suggestion-bg);
  border-radius: 20px;
  border: 2px solid var(--surface-color);
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--suggestion-bg-hover);
}

.app-wrapper {
    height: 100%;
    width: 100%;
    display: flex;
    justify-content: center;
}

.app-wrapper.dual-pane-active {
    justify-content: flex-start;
}

.web-view-pane {
    position: relative; /* Needed for annotation canvas positioning */
    flex: 1;
    height: 100vh; /* Full viewport height */
    border-right: 1px solid var(--border-color);
}

.web-view-pane iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: #fff; /* Set a default background for the iframe */
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 800px;
  background-color: var(--surface-color);
  box-shadow: var(--shadow-lg);
}

.dual-pane-active .app-container {
    width: 450px;
    min-width: 400px;
    max-width: 450px;
    box-shadow: none;
    flex-shrink: 0;
}


.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--surface-color);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--brand-color);
}

.logo svg {
  width: 32px;
  height: 32px;
}
.logo h1 {
  font-size: 1.25rem;
  color: var(--text-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-button-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: visible; /* Changed from hidden to allow dropdown menu */
    background-color: var(--surface-color-2);
}

.action-button-group > *:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.action-button-group .header-button {
    border-radius: 0;
    width: auto;
    height: auto;
    padding: 0.5rem 0.75rem;
    background-color: transparent;
}

.action-button-group .header-button:hover,
.action-button-group .language-button:hover {
    background-color: var(--suggestion-bg);
}

.action-button-group .language-switcher {
    display: flex;
}

.action-button-group .language-button {
    border: none;
    border-radius: 0;
    background-color: transparent;
    height: 100%;
}

.header-button, .login-button {
  background: none;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-text-color);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.login-button {
  border-radius: 8px;
  width: auto;
  padding: 0.5rem 1rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  background-color: var(--surface-color-2);
}
.login-button:hover {
  background-color: var(--suggestion-bg);
}


.header-button:hover {
  background-color: var(--user-message-bg);
  color: var(--primary-color);
}

.header-button svg {
  width: 22px;
  height: 22px;
}

/* --- Language Switcher --- */
.language-switcher {
    position: relative;
}

.language-button {
    background-color: var(--surface-color-2);
    border: 1px solid var(--border-color);
    color: var(--muted-text-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease-in-out;
}
.language-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.language-button svg {
    width: 16px;
    height: 16px;
}
.language-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    width: 150px;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    animation: fadeIn 0.1s ease-out;
}
[dir="rtl"] .language-menu {
    right: auto;
    left: 0;
}
.language-menu button {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: none;
    border: none;
    color: var(--text-color);
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}
[dir="rtl"] .language-menu button {
    text-align: right;
}
.language-menu button:hover {
    background-color: var(--surface-color-2);
}
.language-menu button.active {
    background-color: var(--lang-button-active-bg);
    color: var(--lang-button-active-text);
    font-weight: 500;
}


.page-preview-container {
  position: relative;
  flex-shrink: 0;
}

.page-preview-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background-color: var(--surface-color-2);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--muted-text-color);
  flex-shrink: 0;
}

.preview-favicon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.preview-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-area-wrapper {
  position: relative;
  flex: 1 1 0%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.chat-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  max-width: 90%;
  animation: fadeIn 0.3s ease-in-out;
  flex-direction: column;
}

/* Stop animation and resizing during streaming to prevent flickering */
.message.streaming {
    animation: none;
}
.message.model.streaming .message-bubble {
    width: 100%;
}


.message.user {
  align-self: flex-end;
}
.message.model {
  align-self: flex-start;
}

.message-bubble {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  line-height: 1.6;
  width: fit-content;
  position: relative;
}

.message-bubble.capturing {
    padding: 0.75rem 1rem !important;
}

.message-bubble > *:not(:last-child):not(.message-actions) {
  margin-bottom: 0.5rem;
}


.message.user .message-bubble {
  background-color: var(--user-message-bg);
  color: var(--text-color);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.message.model .message-bubble {
  background-color: var(--model-message-bg);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  padding: 0.5rem;
  padding-bottom: 44px; /* Space for the absolute positioned action bar */
}

.message.model .message-bubble p {
    padding: 0.25rem 0.5rem;
    text-align: justify;
}

.message-bubble p {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.generated-image {
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

.embedded-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 0.0rem;
    margin-bottom: 0.0rem;
    border: 1px solid var(--border-color);
    display: block;
}

.image-loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--muted-text-color);
    min-height: 150px;
}

.suggested-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    max-width: 100%;
}

.suggestion-button {
    background-color: var(--suggestion-bg);
    color: var(--suggestion-text);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.875rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: start;
}

.suggestion-button:hover {
    background-color: var(--suggestion-bg-hover);
}


.initial-state {
  margin: auto;
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--muted-text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 550px;
}
.initial-logo {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}
.initial-logo svg {
  width: 48px;
  height: 48px;
}
.initial-state-subtitle {
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.url-input-form {
  display: flex;
  width: 100%;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.url-input {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-family);
  background-color: var(--surface-color-2);
  color: var(--text-color);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.url-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--user-message-bg);
}

.url-submit-button {
  background-color: var(--brand-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.url-submit-button:hover:not(:disabled) {
  background-color: var(--brand-color-hover);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted-text-color);
  font-size: 0.875rem;
  width: 100%;
  margin-bottom: 1.5rem;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}
.divider:not(:empty)::before {
  margin-right: 0.5em;
}
.divider:not(:empty)::after {
  margin-left: 0.5em;
}
.extension-info {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  background-color: var(--surface-color-2);
  width: 100%;
}
.extension-info h3 {
  font-size: 1rem;
  color: var(--text-color);
  margin-bottom: 0.25rem;
}
.extension-info p {
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
}
.error-state {
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  width: 100%;
  margin-bottom: 1.5rem;
}
.initial-loading {
  margin: auto;
  text-align: center;
  padding: 2rem;
  color: var(--muted-text-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.chat-input-container {
  border-top: 1px solid var(--border-color);
  background-color: var(--surface-color);
  flex-shrink: 0;
  position: relative;
}

.chat-input-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--modal-overlay-bg);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
}
.chat-input-overlay-content {
    background-color: var(--surface-color);
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.chat-input-overlay-content p {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 500;
}

.chat-input-overlay-content .subscribe-button {
    background-color: var(--brand-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}
.chat-input-overlay-content .subscribe-button:hover {
    background-color: var(--brand-color-hover);
}


.chat-input-form-wrapper {
  padding: 1rem 1.5rem;
}
.chat-input-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.chat-input {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 2rem;
  font-size: 1rem;
  font-family: var(--font-family);
  background-color: var(--surface-color-2);
  color: var(--text-color);
  transition: border-color 0.2s, box-shadow 0.2s;
  height: 48px; /* Set fixed height */
}
.chat-input::placeholder {
  color: var(--muted-text-color);
}
.chat-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--user-message-bg);
}
.chat-input:disabled {
  background-color: var(--border-color);
  cursor: not-allowed;
}

.settings-toggle-button {
  background-color: transparent;
  border: none;
  color: var(--muted-text-color);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.settings-toggle-button:hover:not(:disabled) {
  color: var(--primary-color);
  background-color: var(--surface-color-2);
}
.settings-toggle-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.settings-toggle-button.active {
  color: var(--primary-color);
  background-color: var(--user-message-bg);
}
.settings-toggle-button svg {
  width: 24px;
  height: 24px;
}


.model-settings-panel {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--surface-color-2);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeIn 0.2s ease-out;
}
.model-select-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.model-select-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-color);
}
.model-select-group select,
.model-select-group input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-family);
  background-color: var(--surface-color);
  color: var(--text-color);
}
.model-select-group select:focus,
.model-select-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--user-message-bg);
}

.fallback-toggle-group {
    display: flex;
    align-items: center;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.fallback-toggle-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-color);
}

.fallback-toggle-group input[type="checkbox"] {
    margin-left: 1rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.api-url-group {
    grid-column: 1 / -1; /* Span full width on small screens */
}
@media (min-width: 640px) {
    .api-url-group {
        grid-column: 1 / 2;
    }
    .api-key-group {
        grid-column: 2 / 3;
    }
}
.model-select-group input:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.7;
}


.send-button {
  background-color: var(--brand-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 48px; /* Match input height */
  height: 48px; /* Match input height */
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.send-button:hover:not(:disabled) {
  background-color: var(--brand-color-hover);
}

.url-submit-button:disabled,
.send-button:disabled {
  background-color: var(--brand-color);
  cursor: not-allowed;
}

.send-button svg, .send-button .spinner-small {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease-in-out;
}
.send-button svg path {
    /* For standard triangle */
    transform-origin: center;
}

/* --- Voice Input --- */
.mic-button {
  background-color: transparent;
  border: none;
  color: var(--muted-text-color);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.mic-button:hover:not(:disabled) {
  color: var(--primary-color);
}
.mic-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mic-button svg {
  width: 24px;
  height: 24px;
}

.mic-button.recording {
  color: #ef4444; /* Red-500 */
  animation: pulse-mic 1.5s infinite ease-out;
}

.mic-button .spinner-small {
  border-color: var(--suggestion-bg);
  border-left-color: var(--primary-color);
}

@keyframes pulse-mic {
  0% {
    transform: scale(1);
  }
  70% {
     transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.loading-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  gap: 0.75rem;
  color: var(--muted-text-color);
}
.spinner {
  border: 4px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-left-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

.spinner-small {
  border: 3px solid rgba(255, 255, 255, 0.3);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border-left-color: white;
  animation: spin 1s ease-in-out infinite;
}

.scroll-down-button {
    position: absolute;
    bottom: 1rem;
    right: 1.5rem;
    z-index: 10;
    background-color: var(--surface-color);
    color: var(--muted-text-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.2s ease-in-out;
    animation: fadeIn 0.2s;
}
.scroll-down-button:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}
.scroll-down-button svg {
    width: 24px;
    height: 24px;
}

footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--surface-color-2);
  text-align: center;
  flex-shrink: 0;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}
.footer-links button {
  background: none;
  border: none;
  color: var(--muted-text-color);
  cursor: pointer;
  font-size: 0.875rem;
  transition: color 0.2s;
}
.footer-links button:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--modal-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-in-out;
}
.modal-content {
  background-color: var(--surface-color);
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}
.modal-content h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text-color);
}
.modal-content p {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: var(--muted-text-color);
}
.modal-content h2 + p {
  color: var(--text-color);
}
.modal-close-button {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted-text-color);
}

.modal-content .modal-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.modal-content .modal-button-secondary,
.modal-content .modal-button-primary {
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.modal-content .modal-button-secondary {
    background-color: var(--suggestion-bg);
    color: var(--suggestion-text);
    border: 1px solid var(--border-color);
}
.modal-content .modal-button-secondary:hover {
    background-color: var(--suggestion-bg-hover);
    opacity: 0.9;
}

.modal-content .modal-button-primary {
    background-color: var(--brand-color);
    color: white;
}
.modal-content .modal-button-primary:hover {
    background-color: var(--brand-color-hover);
    opacity: 0.9;
}


.tools-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.3rem 1rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--surface-color-2);
  gap: 0.5rem;
}

.tools-toolbar button {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 6px;
  padding: 0.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease-in-out;
}

.tools-toolbar button:hover:not(:disabled) {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background-color: var(--user-message-bg);
}

.tools-toolbar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tools-toolbar button svg {
  width: 20px;
  height: 20px;
}

.screenshot-options {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.screenshot-fieldset {
  border: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.screenshot-fieldset legend {
  font-weight: 500;
  margin-bottom: 0.5rem;
  padding: 0;
  font-size: 1rem;
}
.screenshot-fieldset .radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.screenshot-fieldset .radio-group.horizontal {
  flex-direction: row;
  gap: 1.5rem;
  align-items: center;
}
.screenshot-fieldset .radio-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.screenshot-fieldset input[type="number"],
.screenshot-fieldset input[type="range"] {
  width: 100%;
}

.screenshot-capture-button {
  width: 100%;
  background-color: var(--brand-color);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.screenshot-capture-button:hover {
  background-color: var(--brand-color-hover);
}

/* --- Message Actions --- */
.message-actions {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.message-action-button {
    background: none;
    border: none;
    color: var(--muted-text-color);
    padding: 0.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
    width: 28px;
    height: 28px;
}
.message-action-button:hover {
    color: var(--primary-color);
    background-color: var(--suggestion-bg);
}
.message-action-button svg {
    width: 16px;
    height: 16px;
}
.message-action-button.copied {
    color: #10b981; /* Green color for success */
}
.capturing .message-actions {
    display: none !important;
}

/* Screenshot Dropdown */
.screenshot-action-wrapper {
    position: relative;
}
.screenshot-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 0.5rem;
    background-color: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    width: max-content;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    animation: fadeIn 0.1s ease-out;
}
.screenshot-menu button {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: none;
    border: none;
    color: var(--text-color);
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}
.screenshot-menu button:hover {
    background-color: var(--surface-color-2);
}

/* Share Modal */
.share-modal-content {
    max-width: 500px;
}
.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--surface-color-2);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease-in-out;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
    text-align: center;
}
.share-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}
.share-item svg {
    width: 32px;
    height: 32px;
}
.share-item span {
    font-size: 0.875rem;
    font-weight: 500;
}
.share-separator {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 1.5rem 0;
}
.share-screenshot-area {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.share-status-message {
    font-size: 0.875rem;
    color: var(--muted-text-color);
    min-height: 1.25em; /* Reserve space to prevent layout shift */
    transition: color 0.3s ease-in-out;
}


/* --- Agent Action Message --- */
.agent-action-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
}
.agent-thought {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted-text-color);
    font-style: italic;
}
.agent-thought svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.agent-command {
    background-color: var(--background-color);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    word-break: break-all;
}


/* --- Annotation Styles --- */
.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background-color: transparent;
}

.annotation-text-input {
    position: absolute;
    z-index: 11;
    border: 1px dashed var(--primary-color);
    background-color: rgba(255, 255, 255, 0.8);
    color: black;
    padding: 4px;
    font-family: var(--font-family);
    outline: none;
    resize: none;
    overflow: hidden;
}

.annotation-toolbar {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.2s ease-out;
}
.annotation-toolbar .tool-group {
    display: flex;
    align-items: center;
    padding: 0.25rem;
    border-radius: 6px;
    background-color: var(--background-color);
}
.annotation-toolbar .tool-button {
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    color: var(--muted-text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}
.annotation-toolbar .tool-button:hover {
    background-color: var(--suggestion-bg);
}
.annotation-toolbar .tool-button.active {
    background-color: var(--primary-color);
    color: white;
}
.annotation-toolbar .tool-button svg {
    width: 20px;
    height: 20px;
}
.annotation-toolbar .color-palette {
    display: flex;
    gap: 4px;
}
.annotation-toolbar .color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s;
}
.annotation-toolbar .color-swatch:hover {
    transform: scale(1.1);
}
.annotation-toolbar .color-swatch.active {
    border-color: var(--text-color);
}

.annotation-toolbar .size-control {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.annotation-toolbar .size-button {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--muted-text-color);
}
.annotation-toolbar .size-button:hover {
    background-color: var(--suggestion-bg);
}
.annotation-toolbar .size-button.active {
    background-color: var(--user-message-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.annotation-toolbar .done-button {
    padding: 0.5rem 1rem;
    background-color: var(--brand-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}
.annotation-toolbar .done-button:hover {
    background-color: var(--brand-color-hover);
}
.annotation-toolbar .divider-vertical {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 0.25rem;
}


@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}