/*
 * Ahlsell Product Expert Chatbot - Dark Theme
 * Brand Compliance: Follows Ahlsell Visual Identity Guidelines
 *
 * Typography:
 * - Ahlsell Slab (headings) - Install from Ahlsell brand portal or use Arial fallback
 * - Ahlsell Sans (body text) - Install from Ahlsell brand portal or use Arial fallback
 *
 * Colors (Dark Theme):
 * - Background Dark (#0B1623) - Primary background
 * - Ahlsell Blue (#0073B6) - Primary brand color
 * - Ahlsell Cyan (#009FE3) - Accent color (highlights)
 * - Navy (#023D62) - Secondary elements
 */

/* Font Face Declarations */
@font-face {
    font-family: 'Ahlsell Sans';
    src: url('fonts/AhlsellSans-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Ahlsell Sans';
    src: url('fonts/AhlsellSans-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Ahlsell Sans';
    src: url('fonts/AhlsellSans-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Ahlsell Sans';
    src: url('fonts/AhlsellSans-SemiBold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Ahlsell Sans';
    src: url('fonts/AhlsellSans-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Ahlsell Sans';
    src: url('fonts/AhlsellSans-Italic.otf') format('opentype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Ahlsell Slab';
    src: url('fonts/AhlsellSlab-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Ahlsell Slab';
    src: url('fonts/AhlsellSlab-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Ahlsell Slab';
    src: url('fonts/AhlsellSlabExtraBold.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

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

:root {
    /* Ahlsell Brand Colors - Primary (Official) */
    --ahlsell-blue: #0073B6;
    --ahlsell-navy: #023D62;
    --ahlsell-marine: #023D62;

    /* Ahlsell Brand Colors - Secondary Blue Tones (Official) */
    --ahlsell-blue-60: #80ADD2;
    --ahlsell-blue-45: #A1C2DD;
    --ahlsell-blue-30: #C1D6E8;
    --ahlsell-blue-15: #E0EAF2;
    --ahlsell-background-dark: #0B1623;

    /* Ahlsell Brand Colors - Supporting (Official) */
    --ahlsell-cyan: #009FE3;
    --ahlsell-orange: #FF5900;
    --ahlsell-red: #E60000;

    /* Ahlsell Greyscale (Official) */
    --ahlsell-black: #101415;
    --ahlsell-grey-1: #52555C;
    --ahlsell-grey-2: #A7A7A9;
    --ahlsell-grey-3: #D7D7DA;
    --ahlsell-grey-4: #F5F5F8;

    /* Dark Theme Color Mapping */
    --bg-primary: #0B1623;
    --bg-secondary: #0f1f30;
    --bg-card: rgba(15, 31, 48, 0.8);
    --bg-card-hover: rgba(20, 40, 60, 0.9);
    --bg-input: rgba(255, 255, 255, 0.05);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    --accent-color: #009FE3;
    --accent-hover: #00b8ff;
    --primary-color: #0073B6;
    --highlight-color: #FF5900;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(0, 159, 227, 0.3);

    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --glow: 0 0 20px rgba(0, 159, 227, 0.3);
}

body {
    font-family: 'Ahlsell Sans', Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - Dark & Minimal */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

.header-content h1 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Ahlsell Sans', Arial, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Ahlsell Slab', Arial, sans-serif;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Buttons - Modern Style */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-color);
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--glow);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: none;
    font-size: 1.1rem;
}

.btn-icon:hover {
    background: var(--bg-card);
}

.health-indicator {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.health-indicator.healthy {
    color: var(--success-color);
}

.health-indicator.unhealthy {
    color: var(--error-color);
}

/* User Role Badge */
.user-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: default;
    transition: all 0.2s;
}

.user-role-badge:empty {
    display: none;
}

.user-role-badge.role-admin {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(238, 90, 36, 0.3);
}

.user-role-badge.role-hr_support {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.user-role-badge.role-it_support {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(9, 132, 227, 0.3);
}

.user-role-badge.role-standard {
    background: linear-gradient(135deg, #81ecec 0%, #00b894 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 184, 148, 0.3);
}

.user-role-badge.role-viewer {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
}

.language-dropdown {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.4rem 2rem 0.4rem 0.6rem;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    min-width: 130px;
}

.language-dropdown:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-card-hover);
}

.language-dropdown:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 159, 227, 0.2);
}

.language-dropdown option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    padding: 1.5rem;
    overflow: hidden;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}

/* Welcome Message - Centered Modern Style */
.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 700px;
    margin: 2rem auto;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.welcome-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1.5rem;
    display: block;
    border: 3px solid var(--accent-color);
    box-shadow: var(--glow);
}

.welcome-message h2 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.75rem;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Feature Cards */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: all 0.2s;
}

.feature-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.feature-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.feature-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Example Queries - Modern Cards */
.example-queries {
    text-align: left;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-card-hover);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.example-queries p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.example-queries ul {
    margin: 0;
    padding-left: 1.25rem;
}

.example-queries li {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.example-queries li::marker {
    color: var(--accent-color);
}

/* Messages */
.message {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-in;
}

.message.user {
    flex-direction: row-reverse;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    overflow: hidden;
    align-self: flex-start;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message.user .message-avatar {
    display: none;
}

.message.assistant .message-avatar {
    background: var(--bg-card);
    border: 2px solid var(--accent-color);
}

.message-content {
    padding: 1rem 1.25rem;
    border-radius: 16px;
    max-width: 75%;
}

.message.user .message-content {
    background: var(--accent-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

/* Export Bar */
.export-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.message-content:hover .export-bar {
    opacity: 1;
}

.export-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.25rem;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-color: var(--accent-color);
}

.export-btn:active {
    transform: scale(0.95);
}

/* Compact Cards View */
.compact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 0.5rem 0;
}

.compact-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.compact-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.compact-card-header {
    background: var(--accent-color);
    color: white;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.compact-card-body {
    padding: 0.75rem 1rem;
}

.compact-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.compact-row:last-child {
    border-bottom: none;
}

.compact-key {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 1rem;
}

.compact-value {
    color: var(--text-primary);
    text-align: right;
    word-break: break-word;
    font-weight: 500;
}

.message-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}

.message-text a {
    color: var(--accent-color);
    text-decoration: underline;
}

.message.user .message-text a {
    color: white;
}

.message-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5rem 0;
}

/* Comparison tables */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
}

.comparison-table th {
    background: var(--ahlsell-navy);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
}

.comparison-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table tr:hover td {
    background: var(--bg-card-hover);
}

.comparison-table td:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

/* Markdown Elements - Code Blocks */
.message-text pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-text pre code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
    border-radius: 0;
}

.message-text code {
    background: rgba(0, 159, 227, 0.15);
    color: var(--accent-color);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.9em;
}

/* Markdown Elements - Lists */
.message-text ul,
.message-text ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.message-text li {
    margin: 0.35rem 0;
    line-height: 1.6;
}

.message-text li::marker {
    color: var(--accent-color);
}

.message-text ol li::marker {
    font-weight: 600;
}

/* Markdown Elements - Headings */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
    font-family: 'Ahlsell Slab', Arial, sans-serif;
    color: var(--text-primary);
    margin: 1rem 0 0.5rem;
    line-height: 1.3;
}

.message-text h1 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.message-text h2 {
    font-size: 1.25rem;
}

.message-text h3 {
    font-size: 1.1rem;
}

.message-text h4,
.message-text h5,
.message-text h6 {
    font-size: 1rem;
}

/* Markdown Elements - Blockquote */
.message-text blockquote {
    border-left: 3px solid var(--accent-color);
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    background: var(--bg-card-hover);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

.message-text blockquote p {
    margin: 0;
}

/* Markdown Elements - Horizontal Rule */
.message-text hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}

/* Markdown Elements - Paragraphs */
.message-text p {
    margin: 0.5rem 0;
}

.message-text p:first-child {
    margin-top: 0;
}

.message-text p:last-child {
    margin-bottom: 0;
}

/* Markdown Elements - Emphasis */
.message-text strong,
.message-text b {
    font-weight: 600;
    color: var(--text-primary);
}

.message-text em,
.message-text i {
    font-style: italic;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.4rem;
    padding: 1rem;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* Chat Input - Modern Pill Style */
.chat-input-container {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    align-items: center;
    background: transparent;
}

.chat-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: var(--glow);
}

.chat-input-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.chat-input-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-input {
    flex: 1;
    padding: 0.5rem 0;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    color: var(--text-primary);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-input:focus {
    outline: none;
}

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    border: none;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-send:hover {
    background: var(--accent-hover);
    box-shadow: var(--glow);
    transform: scale(1.05);
}

.btn-send svg {
    width: 20px;
    height: 20px;
}

/* Stop Button */
.btn-stop {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dc3545;
    border: none;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-stop:hover {
    background: #c82333;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.4);
    transform: scale(1.05);
}

/* Modal - Dark Theme */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 10px;
}

.tab-btn {
    padding: 0.6rem 1.25rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.2s;
    flex: 1;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.help-text {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.instructions-textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    margin-bottom: 1rem;
    background: var(--bg-card);
    color: var(--text-primary);
}

.instructions-textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
}

/* Health Status */
.health-status {
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

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

.health-item:last-child {
    border-bottom: none;
}

.health-item-name {
    font-weight: 500;
    color: var(--text-primary);
}

.health-item-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.ok {
    background: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
}

.status-badge.failed {
    background: rgba(220, 53, 69, 0.2);
    color: var(--error-color);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.1);
}

.toast.error {
    border-color: var(--error-color);
    background: rgba(220, 53, 69, 0.1);
}

/* Loader */
.loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Logs Viewer */
.logs-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.logs-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
}

.logs-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.log-entry {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-color);
    border-radius: 8px;
}

.log-entry.error {
    border-left-color: var(--error-color);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.log-type {
    font-weight: bold;
    color: var(--accent-color);
}

.log-type.error {
    color: var(--error-color);
}

.token-badge {
    background: var(--accent-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.log-timestamp {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.log-section {
    margin-top: 0.5rem;
}

.log-section-title {
    font-weight: bold;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}

.log-content {
    background: var(--bg-primary);
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Proof of Concept Stamp */
.poc-stamp {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    transform: rotate(-12deg);
    pointer-events: none;
    opacity: 0.85;
}

.poc-stamp-text {
    font-family: 'Ahlsell Slab', Arial, sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--ahlsell-orange);
    border: 3px solid var(--ahlsell-orange);
    border-radius: 6px;
    padding: 6px 12px;
    background: rgba(11, 22, 35, 0.95);
    text-align: center;
    line-height: 1.2;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .header-content h1 {
        font-size: 0.9rem;
    }

    .main-content {
        padding: 1rem;
    }

    .chat-messages {
        padding: 1rem;
    }

    .welcome-message {
        padding: 2rem 1.5rem;
        margin: 1rem auto;
    }

    .welcome-message h2 {
        font-size: 1.5rem;
    }

    .feature-cards {
        grid-template-columns: 1fr;
    }

    .message-content {
        max-width: 90%;
    }

    .chat-input-container {
        padding: 1rem;
    }

    .modal-content {
        width: 95%;
        border-radius: 12px;
    }

    .poc-stamp {
        bottom: 15px;
        left: 10px;
    }

    .poc-stamp-text {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}
