/* Main Styles for Beaver App */

:root {
    --cafe-noir: #4B3621;
    --verdigris: #43B3AE;
    --asparagus: #87A96B;
    --buff: #F0DC82;
    --light-blue: #ADD8E6;
    --bg: #ffffff;
    --muted: #6B5B4A;
    --card-shadow: 0 6px 20px rgba(75, 54, 33, 0.08);
    --glass: rgba(10, 10, 10, 0.02);
    --radius-md: 10px;
    --thread-background: #9fcccc80;
    --beaver-green: #4CAF50;
    --beaver-dark-green: #2E7D32;
    --text-color: #333333;
    --light-text-color: #666666;
    --border-color: #dddddd;
    --light-background: #f9f9f9;
    --white: #ffffff;
}

.mobile-profile {
    display: none;
}

/* Technical details toggle link styles */
.tech-toggle {
    display: inline-block;
    font-size: 0.9em;
    color: var(--verdigris);
    text-decoration: none;
    margin-bottom: 15px;
}

.tech-toggle:hover {
    text-decoration: underline;
}

/* Styling for tool calls and results when visible */
.tool-call, .tool-result {
    background-color: #f5f5f5;
    border-left: 3px solid var(--verdigris);
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

.tool-call h4, .tool-result h4 {
    margin-top: 0;
    color: var(--verdigris);
    font-size: 0.9em;
}

/* Container for tool details content with proper scrolling constraints */
.tool-details-container {
    max-width: 100%;
    width: 100%;
    max-height: 300px;
    overflow-x: auto;
    overflow-y: auto;
    border-radius: 4px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    box-sizing: border-box;
}

.tool-details-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75em;
    line-height: 1.4;
    margin: 0;
    padding: 12px;
    min-width: 0;
    background-color: #f8f9fa;
    color: #2d3748;
}

/* Tool header with copy button */
.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #e2e8f0;
    border-bottom: 1px solid #cbd5e0;
    margin: 0;
}

.tool-label {
    font-size: 0.8em;
    font-weight: 600;
    color: #4a5568;
}

/* Copy JSON button */
.copy-json-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: #4299e1;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.copy-json-btn:hover {
    background-color: #3182ce;
}

.copy-json-btn svg {
    width: 12px;
    height: 12px;
}

.tool-content-body {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px;
    max-width: 100%;
    margin: 0;
    padding: 10px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85em;
    line-height: 1.4;
    background-color: #ffffff;
    border: none;
    box-sizing: border-box;
}

/* Styling for simplified tool use and result indications */
.simplified-result, .simplified-tool {
    font-size: 0.85em;
    color: #666;
    padding: 5px 0;
    margin: 5px 0;
    border-top: 1px dashed #ddd;
    border-bottom: 1px dashed #ddd;
}

.simplified-tool {
    color: #777;
    font-style: italic;
    margin: 0;
}

/* Hidden message styling */
.hidden-message {
    opacity: 0.7;
}

.hidden-indicator {
    font-size: 0.8em;
    color: #666;
    margin-bottom: 5px;
    font-style: italic;
}


/* Markdown Content Styles */
.markdown-content {
    line-height: 1.6;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.2em;
    margin-bottom: 0.8em;
}

.markdown-content h1 {
    font-size: 1.8em;
}

.markdown-content h2 {
    font-size: 1.5em;
}

.markdown-content h3 {
    font-size: 1.3em;
}

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 2em;
    margin-bottom: 1em;
}

.markdown-content li {
    margin-bottom: 0.5em;
}

.markdown-content pre {
    background-color: #f5f5f5;
    padding: 1em;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1em;
}

.markdown-content code {
    background-color: #f5f5f5;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
}

.markdown-content blockquote {
    border-left: 4px solid #ddd;
    padding-left: 1em;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
}

.markdown-content table th,
.markdown-content table td {
    border: 1px solid #ddd;
    padding: 0.5em;
}

.markdown-content table th {
    background-color: #f5f5f5;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 2em 0;
}

.markdown-content a {
    color: var(--verdigris);
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}


/* Global Styles */
body {
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text-color);
    background-color: var(--white);
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--beaver-green);
    text-decoration: none;
}

a:hover {
    color: var(--verdigris);
}

/* Typography */
h1 {
    color: var(--cafe-noir);
    margin-top: 1em;
    margin-bottom: 0.5em;
}

h2, h3, h4, h5, h6 {
    color: var(--text-color);
    margin-top: 1em;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1em;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 1001;
    background-color: var(--white);
}

.logo {
    font-family: 'Arial Black', Gadget, sans-serif;
    font-weight: bold;
    font-size: 28px;
    color: var(--verdigris);
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.logo span {
    font-weight: bold;
    color: var(--cafe-noir);
}

/* Header layout with right items group */
.header-right-items {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Avatar that only shows on mobile */
.mobile-only-avatar {
    display: none;
}

@media (max-width: 768px) {
    /* Show hamburger menu and user icon on mobile */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-only-avatar {
        display: block;
    }

    /* Hide the desktop avatar and navigation on mobile */
    header > div:last-child .user-initials {
        display: none;
    }

    .desktop-nav {
        display: none;
    }
}

/* Navigation */
nav {
    display: flex;
    align-items: center;
    margin-left: 40px;
}

nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    height: 100%;
}

nav ul li {
    margin-left: 20px;
    display: flex;
    align-items: center;
}

nav a {
    color: var(--text-color);
    font-weight: bold;
}

nav a:hover {
    color: var(--verdigris);
}

/* Buttons */
.button {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--white);
    border: 2px solid var(--text-color);
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s;
    align-self: center;
}

.button:hover {
    color: var(--verdigris);
    border-color: var(--verdigris);
}

.button.primary {
    background-color: var(--verdigris);
    border-color: var(--verdigris);
    color: var(--white);
}

.button.primary:hover {
    background-color: #379c98;
    border-color: #379c98;
}

.button:disabled {
    background-color: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.button.primary:disabled {
    background-color: #ccc !important;
    border-color: #ccc !important;
    color: #888 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.button:disabled:hover {
    background-color: #f5f5f5 !important;
    border-color: #ccc !important;
    color: #999 !important;
}

.button.primary:disabled:hover {
    background-color: #ccc !important;
    border-color: #ccc !important;
    color: #888 !important;
}

.button.danger {
    background-color: #d32f2f;
    border-color: #d32f2f;
    color: var(--white);
}

.button.danger:hover {
    background-color: #b71c1c;
    border-color: #b71c1c;
}

/* Button spinner */
.button-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: button-spin 1s linear infinite;
    margin-right: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.button.loading .button-spinner {
    opacity: 1;
}

.button.loading {
    position: relative;
    color: #888 !important;
    pointer-events: none;
}

.button.primary.loading {
    background-color: #ccc !important;
    border-color: #ccc !important;
    color: #888 !important;
}

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

/* Form Elements */
input, textarea, select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--verdigris);
    outline: none;
}

input:disabled, textarea:disabled, select:disabled {
    background-color: #f9f9f9 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

textarea[readonly] {
    background-color: #f9f9f9 !important;
    color: #666 !important;
    cursor: not-allowed !important;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

/* Form Layouts */
.form-group {
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
    gap: 15px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--light-background);
    font-weight: bold;
}

/* User Avatar and Initials */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    transition: border-color 0.3s;
}

.user-avatar:hover {
    border-color: var(--verdigris);
}

.user-initials {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--verdigris);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.3s;
}

.user-initials:hover {
    background-color: #379c98;
}

.user-initials-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--verdigris);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 32px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Account Page Styles */
.account-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 0;
}

.account-profile {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--light-background);
    border-radius: 8px;
}

.account-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.account-avatar-large {
    display: flex;
    justify-content: center;
    align-items: center;
}

.account-details h2 {
    margin-top: 0;
    margin-bottom: 5px;
}

.account-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.account-section h3 {
    margin-top: 0;
    color: var(--verdigris);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.settings-item {
    padding: 10px 0;
    margin: 5px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-info {
    font-size: 0.9em;
    color: var(--light-text-color);
    margin-top: 15px;
}

/* Account Danger Zone */
.account-danger-zone {
    margin-top: 40px;
    padding: 20px;
    border: 2px solid #d32f2f;
    border-radius: 8px;
    background-color: #fef5f5;
}

.account-danger-zone h3 {
    color: #d32f2f;
    margin-top: 0;
}

/* Delete Account Page */
.delete-account-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 0;
}

.warning-box {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.warning-box h2 {
    color: #856404;
    margin-top: 0;
    margin-bottom: 15px;
}

.warning-box p, .warning-box ul {
    color: #856404;
}

.warning-box ul {
    margin-left: 20px;
}

.error-box {
    background-color: #f8d7da;
    border: 2px solid #d32f2f;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    color: #721c24;
}

.delete-form {
    margin-top: 30px;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--white);
}

.delete-form-plain {
    margin-top: 30px;
}

/* Account Deletion Confirmation */
.deletion-confirmation {
    background-color: #d4edda;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0 40px 0;
    text-align: center;
    color: #155724;
}

.deletion-confirmation h2 {
    color: #155724;
    margin-top: 0;
    margin-bottom: 10px;
}

/* Badge Styling */
.badge {
    display: inline-block;
    font-size: 0.75em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    margin-left: 8px;
}

.proactive-badge {
    background-color: #9c27b0; /* Purple color for proactive */
    color: white;
}

/* Cards and Boxes */
.card {
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    margin: 0;
}

/* Hero Section */
.hero-container {
    position: relative;
    width: 100%;
    padding-bottom: 50px;
    border-radius: 15px;
    overflow: hidden;
}

.hero-image {
    width: 100%;
    display: block;
    border-radius: 15px;
}

.hero-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-text h1 {
    font-family: 'Arial Black', Gadget, sans-serif;
    font-size: 144px;
    color: white;
    margin: 0;
    padding: 0;
    text-align: center;
    width: 60%;
}

/* Chat Styles */
.thread-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Ensure all message content is properly contained */
.thread-container * {
    max-width: 100%;
    box-sizing: border-box;
}

.message {
    padding: 15px;
    border-radius: 10px;
    max-width: 80%;
    margin: 5px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    box-sizing: border-box;
}

.message.user {
    align-self: flex-end;
    background-color: var(--light-background);
}

.message.model,
.message.assistant,
.message.system {
    align-self: flex-start;
    background-color: var(--thread-background);
}

.message.tool_call {
    align-self: flex-start;
    background-color: #f0f0f0;
    font-family: monospace;
    white-space: pre-wrap;
    width: 90%;
}

.message.tool {
    align-self: flex-start;
    background-color: #e6eef7;
    font-family: monospace;
    white-space: pre-wrap;
    width: 90%;
}

/* Remove margins from paragraphs inside messages to prevent uneven spacing */
.message p {
    margin: 0;
}

.message .markdown-content p {
    margin: 0;
}

/* Keep spacing between multiple paragraphs in messages */
.message p + p,
.message .markdown-content p + p {
    margin-top: 1em;
}

.thread-input {
    margin-top: 20px;
}

/* System Prompt Styles */
.system-prompt-container {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    margin-bottom: 20px;
}

.system-prompt {
    background-color: #fef9e6;
    border-radius: 10px;
    padding: 15px;
    max-width: 80%;
    align-self: flex-start;
}

/* Calendar Table */
.calendar-table input[type="radio"] {
    width: auto;
    margin: 0 5px;
}

/* Hamburger Menu */
.menu-toggle {
    display: none; /* Hide by default on desktop */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--verdigris);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* Animation for hamburger menu icon */
.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background-color: var(--white);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

@media (max-width: 768px) {
    /* Show hamburger menu on mobile */
    .menu-toggle {
        display: flex;
    }

    .mobile-nav {
        display: block;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-in-out;
    }

    .mobile-nav.active {
        max-height: 300px; /* Adjust based on menu content */
    }
}

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

.mobile-profile {
    padding: 20px 20px;
    background-color: var(--light-background);
    border-bottom: 1px solid var(--border-color);
}

.mobile-account-link {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-nav ul li {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    list-style-type: none;
    list-style-image: none;
}

.mobile-nav a {
    color: var(--text-color);
    font-weight: bold;
    display: block;
}

.mobile-nav a:hover {
    color: var(--verdigris);
}

.mobile-logout-button {
    background: none;
    border: none;
    color: var(--text-color);
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    text-align: left;
    width: 100%;
}

.mobile-logout-button:hover {
    color: var(--verdigris);
}

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--light-text-color);
}

.empty-state h1 {
    color: var(--text-color);
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 18px;
}

/* Delete thread button styling */
.delete-thread-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
    color: #d32f2f; /* Red color for the icon */
}

.delete-thread-btn .material-icons {
    font-size: 22px;
    color: inherit;
}

.delete-thread-btn:hover {
    background-color: #ffebee; /* Pale red background on hover */
    transform: scale(1.1);
    color: #d32f2f; /* Keep same red color on hover */
}

.delete-thread-btn:active {
    background-color: #ffcdd2; /* Slightly darker pale red when clicked */
    transform: scale(0.95);
}

/* Read-only styling for delete button (when impersonating) */
.delete-thread-btn.read-only {
    color: #999; /* Gray color for read-only */
    cursor: default;
    pointer-events: none; /* Disable all mouse interactions */
}

.delete-thread-btn.read-only:hover {
    background-color: transparent; /* No hover effect */
    transform: none; /* No scaling */
    color: #999; /* Keep gray color */
}

.delete-thread-btn.read-only:active {
    background-color: transparent; /* No active effect */
    transform: none; /* No scaling */
}

/* Mobile styles for delete button */
@media (max-width: 768px) {
    .delete-thread-btn {
        width: 36px;
        height: 36px;
    }

    .delete-thread-btn .material-icons {
        font-size: 24px;
    }

    .delete-thread-btn:hover {
        transform: scale(1.05); /* Less aggressive scaling on mobile */
    }

    /* Stack delete confirmation buttons vertically on mobile */
    .delete-confirmation-banner div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
}

/* Flash Messages Styling */
.messages-container {
  margin: 20px 0;
  padding: 0;
}

.messages-container .message {
  padding: 12px 16px;
  margin-bottom: 10px;
  border-radius: 8px;
  font-weight: 500;
  border: 1px solid;
}

.messages-container .message-success {
  background-color: #e8f5e9;
  border-color: var(--beaver-green);
  color: #2e7d32;
}

.messages-container .message-error {
  background-color: #ffebee;
  border-color: #f44336;
  color: #c62828;
}

.messages-container .message-info {
  background-color: #e3f2fd;
  border-color: #2196f3;
  color: #1565c0;
}

/* Mobile Thread Views Styling */
.mobile-back-button {
    display: none;
    padding: 10px 0 20px 0;
    margin-bottom: 15px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--verdigris);
    font-weight: bold;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.back-arrow {
    margin-right: 8px;
    font-size: 20px;
}

.back-link:hover {
    text-decoration: none;
    border-bottom: 1px solid var(--verdigris);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        padding: 0;
    }

    main {
        padding: 0 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.5em;
    }

    .hero-text h1 {
        font-size: 48px;
    }

    header {
        height: 60px;
        position: relative;
        padding: 0 15px;
        justify-content: space-between;
    }

    header > div:first-child {
        width: 100%;
        justify-content: space-between;
    }

    .logo {
        font-size: 24px;
    }

    .logo img {
        width: 40px;
        height: 40px;
    }

    /* Hide desktop nav and logout button in header */
    header nav.desktop-nav {
        display: none;
    }

    header form {
        display: none !important;
    }

    .message {
        max-width: 90%;
    }

    .button {
        padding: 8px 12px;
        font-size: 14px;
    }

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

    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px 5px;
    }

    .calendar-table {
        overflow-x: auto;
        display: block;
    }

    .form-actions {
        margin-top: 15px;
    }

    /* Increase tap target sizes for better mobile UX */
    nav ul li {
        margin-bottom: 10px;
    }

    /* Improved form spacing on mobile */
    .form-group {
        margin-bottom: 15px;
    }

    .card {
        padding: 15px;
        margin-bottom: 15px;
    }

    /* Adjustments for thread interface on mobile */
    .thread-container {
        gap: 5px;
    }

    .message {
        padding: 12px;
        font-size: 15px;
        line-height: 1.4;
        margin: 5px;
    }

    .thread-input textarea {
        min-height: 100px;
    }

    /* Better spacing for mobile forms */
    .form-actions .button {
        margin-left: auto;
    }

    /* Mobile Thread Views */
    .home-layout {
        display: block !important;
        gap: 0 !important;
    }

    .threads-sidebar {
        max-width: 100% !important;
        width: 100% !important;
        border-right: none !important;
        padding-right: 0 !important;
    }

    .thread-content {
        width: 100% !important;
    }

    /* Fix for new thread form visibility */
    .threads-sidebar:not(.mobile-hidden) + .thread-content {
        display: block;
    }

    @media (max-width: 768px) {
        /* On mobile, hide thread content by default */
        .thread-content {
            display: none !important;
        }

        /* Fix for new thread form visibility on mobile */
        .threads-sidebar:not(.mobile-hidden) + .thread-content {
            display: none !important;
        }

        /* When thread is selected, hide threads and show content */
        .mobile-hidden {
            display: none !important;
        }

        .mobile-visible {
            display: block !important;
        }

        /* Show back button when thread is selected */
        .mobile-back-button {
            display: none;
        }

        /* Only show back button in mobile view when thread is selected */
        .mobile-visible .mobile-back-button {
            display: block;
            position: sticky;
            top: 0;
            background-color: var(--white);
        }
    }
}

/* === LANDING PAGE STYLES === */

/* Landing page reset to override app styles */
.page-wrapper * {
    box-sizing: border-box;
}

.page-wrapper a {
    text-decoration: none;
}

.page-wrapper button {
    font-family: inherit;
}

/* Landing page specific container - higher specificity */
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    background: var(--bg);
    color: var(--cafe-noir);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Decorative log accents */
.page-wrapper .bg-log {
    position: absolute;
    pointer-events: none;
    opacity: 0.28;
    filter: drop-shadow(0 6px 10px rgba(75, 54, 33, 0.04));
}

.page-wrapper .bg-log.one {
    top: 22%;
    left: -40px;
    width: 140px;
    transform: rotate(-6deg);
    opacity: 0.22;
}

.page-wrapper .bg-log.two {
    position: fixed;
    bottom: 22%;
    right: 20px;
    width: 180px;
    transform: rotate(-6deg);
    opacity: 0.35;
    z-index: 5;
}

.page-wrapper .bg-log.three {
    top: 66%;
    left: 28%;
    width: 96px;
    transform: rotate(6deg);
    opacity: 0.22;
}

/* Landing page main content */
.page-wrapper .landing-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 36px;
    padding: 48px 28px 96px;
    z-index: 10;
}

.page-wrapper .landing-main h1 {
    max-width: 880px;
    margin: 0;
    font-size: 40px;
    line-height: 1.04;
    font-weight: 800;
    color: var(--cafe-noir);
    letter-spacing: -0.02em;
}

.page-wrapper .primary-cta {
    background: var(--verdigris);
    color: #fff !important;
    border: 0;
    padding: 18px 40px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 18px;
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
    text-decoration: none;
}

.page-wrapper .primary-cta:hover {
    transform: translateY(-3px);
    background: #379c98;
}

.page-wrapper p.lead {
    max-width: 820px;
    margin: 0;
    font-size: 18px;
    color: var(--muted);
}

/* Feature band */
.page-wrapper .features-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
    background: linear-gradient(180deg, rgba(173, 216, 230, 0.12), rgba(173, 216, 230, 0.06));
    padding: 24px;
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    max-width: 980px;
    width: calc(100% - 48px);
}

.page-wrapper .features {
    text-align: left;
    max-width: 520px;
    width: 100%;
    padding: 4px 8px;
}

.page-wrapper .features ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: block;
}

.page-wrapper .features li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
    font-size: 18px;
}

.page-wrapper .features svg,
.page-wrapper .features img {
    flex-shrink: 0;
    height: 30px;
    width: 30px;
    object-fit: contain;
}

.page-wrapper .features svg {
    stroke-width: 2.8;
}

.page-wrapper .mascot-hero {
    width: 170px;
    height: 170px;
    flex-shrink: 0;
    object-fit: contain;
}

/* Landing page H2 */
.page-wrapper .landing-main h2 {
    max-width: 760px;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--cafe-noir);
}

/* Testimonials */
.page-wrapper .testimonials {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    max-width: 900px;
    padding: 0 8px;
}

.page-wrapper .testimonial {
    display: block;
    background: var(--light-blue);
    border-left: 6px solid var(--verdigris);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: var(--card-shadow);
    font-style: italic;
    font-size: 17px;
    color: var(--cafe-noir);
}

.page-wrapper .testimonial footer {
    font-style: normal;
    margin-top: 12px;
    color: var(--muted);
    font-weight: 700;
}

/* second testimonial variant */
.page-wrapper .testimonial.alt {
    background: rgba(240, 220, 130, 0.12); /* buff tint */
    border-left-color: var(--asparagus);
}

/* final CTA + mascot */
.page-wrapper .final-cta-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.page-wrapper .final-cta-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.page-wrapper .final-cta {
    background: var(--verdigris);
    color: #fff !important;
    padding: 18px 44px;
    border-radius: 8px;
    font-weight: 800;
    border: 0;
    font-size: 18px;
    box-shadow: var(--card-shadow);
    text-decoration: none;
    cursor: pointer;
}

.page-wrapper .final-mascot {
    width: 92px;
    height: 92px;
    object-fit: contain;
}

.page-wrapper .site-footer {
    margin-top: auto;
    padding: 24px 20px;
    text-align: center;
    background: var(--cafe-noir);
    color: white;
    font-size: 13px;
}

/* Landing page responsive */
/* Desktop layout - features side by side */
@media (min-width: 881px) {
    .page-wrapper .features-wrap {
        flex-direction: row;
        gap: 36px;
    }

    .page-wrapper .features {
        text-align: left;
    }
}

/* Mobile/tablet layout */
@media (max-width: 880px) {
    .page-wrapper .features-wrap {
        gap: 18px;
        padding: 18px;
    }

    .page-wrapper .features {
        text-align: center;
    }

    .page-wrapper .features li {
        justify-content: center;
    }

    .page-wrapper .mascot-hero {
        width: 140px;
        height: 140px;
    }

    .page-wrapper .final-cta-row {
        flex-direction: column;
    }

    .page-wrapper .final-mascot {
        width: 110px;
        height: 110px;
    }

    .page-wrapper .landing-main h1 {
        font-size: 32px;
    }
}

/* Admin Table Styles */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background-color: var(--light-background);
    font-weight: bold;
}

.admin-table th[data-sort] {
    cursor: pointer;
    user-select: none;
}

.admin-table th.sorted-asc::after,
.admin-table th.sorted-desc::after {
    content: '';
    border: 4px solid transparent;
    border-top-color: currentColor;
    margin-left: 6px;
    display: inline-block;
}

.admin-table th.sorted-desc::after {
    border-top-color: transparent;
    border-bottom-color: currentColor;
}

@media (max-width: 768px) {
    .admin-table th,
    .admin-table td {
        padding: 8px;
        font-size: 0.9em;
    }
}

/* Stats Grid */
.stats-grid {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-card h3 {
    font-size: 2em;
    margin: 0 0 5px 0;
    color: var(--verdigris);
}

.stat-card p {
    margin: 0;
    color: #6c757d;
    font-weight: 500;
}

@media (max-width: 768px) {
    .stats-grid {
        flex-direction: column;
    }
}
