/* MotherOS — Mørkt tema (#2d2d2d) inspireret af Heartroom */

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

:root {
    --bg: #2d2d2d;
    --bg-light: #383838;
    --bg-input: #3a3a3a;
    --text: #e0e0e0;
    --text-dim: #999;
    --accent: #5b9bd5;
    --accent-hover: #4a8bc4;
    --border: #444;
    --success: #6dbf6d;
    --warning: #d4a84d;
    --error: #d45b5b;
    --font: 'Georgia', serif;
    --font-mono: 'Courier New', monospace;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 18px;
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === HEADER === */
header {
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

header h1 {
    font-size: 22px;
    color: var(--accent);
    font-weight: normal;
    letter-spacing: 2px;
}

header nav {
    display: flex;
    gap: 16px;
}

header nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-family: Arial, sans-serif;
    transition: color 0.2s;
}

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

header nav a.active {
    color: var(--accent);
}

/* === CHAT CONTAINER === */
#chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
}

#input-area {
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
}

#session-bar {
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
}

/* === BESKEDER === */
.message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 17px;
    line-height: 1.6;
    animation: fadeIn 0.2s ease-in;
}

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

.message.user {
    align-self: flex-end;
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

/* Markdown i assistant-svar */
.message.assistant p {
    margin-bottom: 10px;
}

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

.message.assistant code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 15px;
}

.message.assistant pre {
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message.assistant pre code {
    padding: 0;
    background: none;
}

.message.assistant ul, .message.assistant ol {
    padding-left: 24px;
    margin: 8px 0;
}

.message.assistant strong {
    color: var(--accent);
}

.message.assistant a {
    color: var(--accent);
}

.message.assistant table {
    border-collapse: collapse;
    margin: 10px 0;
    width: 100%;
}

.message.assistant th, .message.assistant td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
    font-size: 15px;
}

.message.assistant th {
    background: var(--bg);
}

/* Memory-notifikation */
.memory-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-family: Arial, sans-serif;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 8px;
}

/* Typing-indikator */
.typing {
    align-self: flex-start;
    padding: 14px 18px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    color: var(--text-dim);
    font-style: italic;
    font-size: 15px;
}

/* === INPUT-OMRÅDE === */
#input-area {
    padding: 16px 20px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

#message-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    resize: none;
    min-height: 48px;
    max-height: 150px;
    outline: none;
    transition: border-color 0.2s;
}

#message-input:focus {
    border-color: var(--accent);
}

#message-input::placeholder {
    color: var(--text-dim);
}

#send-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
    align-self: flex-end;
}

#send-btn:hover {
    background: var(--accent-hover);
}

#send-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
}

/* === SESSION BAR === */
#session-bar {
    padding: 8px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-family: Arial, sans-serif;
    color: var(--text-dim);
    flex-shrink: 0;
}

#new-session-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
}

#new-session-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* === MEMORY PAGE === */
.memory-page {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.memory-page h2 {
    color: var(--accent);
    margin-bottom: 20px;
    font-weight: normal;
}

.memory-card {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.memory-card .content {
    flex: 1;
}

.memory-card .category {
    display: inline-block;
    background: var(--bg);
    color: var(--accent);
    font-size: 11px;
    font-family: Arial, sans-serif;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.memory-card .text {
    font-size: 16px;
}

.memory-card .meta {
    font-size: 12px;
    color: var(--text-dim);
    font-family: Arial, sans-serif;
    margin-top: 4px;
}

.memory-card .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.memory-card .actions button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: Arial, sans-serif;
    transition: all 0.2s;
}

.memory-card .actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.memory-card .actions button.delete:hover {
    border-color: var(--error);
    color: var(--error);
}
/* Projekt-filter */
.project-filter {
    margin-bottom: 1.5rem;
}

.project-filter select {
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Projekt-badge på memory-cards */
.project-badge {
    background: #1a3a4a;
    color: #5bb8d4;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.03em;
}
/* Add memory form */
.add-memory-form {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.add-memory-form select,
.add-memory-form input,
.add-memory-form textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: var(--font);
    font-size: 15px;
    width: 100%;
    margin-bottom: 8px;
    outline: none;
}

.add-memory-form select:focus,
.add-memory-form input:focus,
.add-memory-form textarea:focus {
    border-color: var(--accent);
}

.add-memory-form button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.add-memory-form button:hover {
    background: var(--accent-hover);
}

/* Empty state */
.empty-state {
    text-align: center;
    color: var(--text-dim);
    padding: 60px 20px;
    font-style: italic;
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
    body {
        font-size: 16px;
    }

    header {
        padding: 10px 14px;
    }

    header h1 {
        font-size: 17px;
    }

    nav a {
        font-size: 13px;
        padding: 6px 10px;
    }

    .message {
        max-width: 95%;
        font-size: 16px;
        padding: 12px 14px;
    }

    #input-area {
        padding: 10px 12px;
        gap: 8px;
    }

    #message-input {
        font-size: 16px;  /* Forhindrer iOS zoom ved fokus */
        padding: 12px 14px;
        min-height: 48px;
        border-radius: 10px;
    }

    #send-btn {
        padding: 12px 16px;
        font-size: 14px;
        min-width: 52px;
        border-radius: 10px;
    }

    /* Mikrofon og TTS-knapper større på mobil */
    #mic-btn, #tts-btn {
        font-size: 20px;
        padding: 10px;
        min-width: 44px;
        min-height: 44px;
        border-radius: 10px;
    }

    #session-bar {
        padding: 6px 12px;
        font-size: 12px;
    }

    .memory-page {
        padding: 10px 12px;
    }

    .memory-card {
        padding: 12px 14px;
        flex-direction: column;
        gap: 8px;
    }

    .memory-card .actions {
        flex-direction: row;
        align-self: flex-end;
    }

    /* Biografi-siden */
    .biografi-page {
        padding: 10px 12px;
    }

    .biografi-controls {
        flex-direction: column;
        gap: 8px;
    }

    .biografi-controls button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
    }
}

/* Ekstra touch-venlig justering for alle mobile enheder */
@media (hover: none) and (pointer: coarse) {
    #send-btn, #mic-btn, #tts-btn, button {
        min-height: 44px; /* Apple's anbefalede minimum touch-target */
    }
}
