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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    height: 100vh;
    display: flex;
}

/* === SIDEBAR === */

#sidebar {
    width: 260px;
    background: #16213e;
    padding: 15px;
    overflow-y: auto;
    border-right: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
}

#sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#sidebar-logo {
    max-width: 80%;
    height: auto;
    display: block;
    margin: 0 auto;
}

#sidebar-header h2 {
    color: #e94560;
    font-size: 16px;
}

#user-info {
    font-size: 12px;
    color: #a0a0a0;
    margin-bottom: 15px;
}

#logout-btn {
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
}

#logout-btn:hover { color: #e94560; }

#new-chat {
    background: #e94560;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 15px;
}

#new-chat:hover { background: #c73650; }

/* === SAMTALER I SIDEBAR === */

.conv-item {
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #a0a0a0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-item:hover { background: #0f3460; color: #e0e0e0; }
.conv-item.active { background: #0f3460; color: #e94560; }

.conv-item-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    border-radius: 6px;
}

.conv-item-wrapper:hover .conv-actions {
    display: flex;
}

.conv-item {
    flex: 1;
    margin-bottom: 0;
}

.conv-actions {
    display: none;
    gap: 2px;
    flex-shrink: 0;
    padding-right: 4px;
}

.conv-action-btn {
    background: none;
    border: none;
    color: #a0a0a0;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 5px;
    border-radius: 4px;
}

/* === BULK-SELECTION (Session 20) === */

.conv-item-wrapper {
    position: relative;
}

.conv-checkbox {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    cursor: pointer;
    accent-color: #e94560;
}

.conv-item {
    padding-left: 30px;
}

.bulk-toolbar {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #0f3460;
    border-radius: 4px;
    margin: 6px 0;
    font-size: 12px;
    color: #e0e0e0;
}

.bulk-count {
    flex: 1;
    font-weight: bold;
}

.bulk-btn {
    background: transparent;
    border: 1px solid #a0a0a0;
    color: #e0e0e0;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.bulk-btn:hover {
    background: #1a4a80;
}

.bulk-btn.danger {
    border-color: #e94560;
    color: #e94560;
}

.bulk-btn.danger:hover {
    background: #e94560;
    color: #ffffff;
}

.bulk-move-select {
    background: #0a1929;
    color: #e0e0e0;
    border: 1px solid #a0a0a0;
    border-radius: 3px;
    padding: 4px 6px;
    font-size: 12px;
    cursor: pointer;
}

.conv-action-btn:hover {
    background: #0f3460;
    color: #e94560;
}

.download-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    z-index: 100;
    min-width: 120px;
    padding: 4px 0;
}

.download-menu.open {
    display: block;
}

.download-menu a {
    display: block;
    padding: 6px 12px;
    color: #a0a0a0;
    text-decoration: none;
    font-size: 12px;
}

.download-menu a:hover {
    background: #0f3460;
    color: #e94560;
}

/* === KONTEKSTFILER I SIDEBAR === */

.context-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
    color: #a0a0a0;
}

.context-file span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-delete {
    background: none;
    border: none;
    color: #e94560;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    flex-shrink: 0;
}

.context-delete:hover {
    color: #ff6b81;
}

.context-upload-btn {
    display: block;
    text-align: center;
    padding: 8px;
    margin-top: 8px;
    border: 1px dashed rgba(255,255,255,0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    color: #a0a0a0;
    transition: all 0.2s;
}

.context-upload-btn:hover {
    color: #e0e0e0;
    border-color: rgba(255,255,255,0.5);
}

.context-upload-btn input {
    display: none;
}

.project-delete-btn {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 6px 8px;
    background: transparent;
    border: 1px solid rgba(233,69,96,0.5);
    border-radius: 8px;
    color: #e94560;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
}

.project-delete-btn:hover {
    background: rgba(233,69,96,0.15);
    border-color: #e94560;
}

/* === HOVEDOMRÅDE === */

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* === VELKOMSTSKÆRM === */

#welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#welcome-screen.hidden {
    display: none;
}

#welcome-screen img {
    max-width: 320px;
    width: 80%;
    margin-bottom: 20px;
}

#welcome-screen .welcome-tagline {
    color: #a0a0a0;
    font-size: 14px;
    font-style: italic;
    text-align: center;
    max-width: 400px;
    line-height: 1.6;
}

#welcome-screen .welcome-hint {
    color: #666;
    font-size: 12px;
    margin-top: 20px;
}

/* HAL nyheder på velkomstskærm */
#hal-news {
    color: #888;
    font-size: 0.85em;
    margin-top: 20px;
    white-space: pre-line;
    max-width: 500px;
    text-align: left;
    line-height: 1.6;
}

/* === BESKEDER === */

.message {
    position: relative;
    max-width: 800px;
    margin: 0 auto 20px auto;
    padding: 15px;
    border-radius: 8px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.user-msg {
    background: #0f3460;
    color: #e0e0e0;
}

.assistant-msg {
    background: #16213e;
    color: #e0e0e0;
    border: 1px solid #0f3460;
}

.loading-msg {
    background: #16213e;
    color: #a0a0a0;
    border: 1px solid #0f3460;
    font-style: italic;
    animation: pulse 1.5s infinite;
}

/* HAL streaming eye */
.streaming-cursor::after {
    content: "●";
    color: #ff3333;
    animation: hal-pulse 1.5s ease-in-out infinite;
    margin-left: 4px;
}

@keyframes hal-pulse {
    0%, 100% { opacity: 0.3; text-shadow: none; }
    50% { opacity: 1; text-shadow: 0 0 8px #ff3333; }
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.copy-btn-group {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.message:hover .copy-btn-group { opacity: 1; }

.copy-btn {
    background: rgba(233, 69, 96, 0.55);
    border: none;
    border-radius: 4px;
    color: white;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
    transition: background 0.2s;
}

.copy-btn:hover { background: rgba(233, 69, 96, 0.9); }

/* === FEJLBESKEDER (Trin 2) === */

.error-msg {
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid rgba(233, 69, 96, 0.4);
    color: #ff8a9e;
    max-width: 800px;
    margin: 0 auto 20px auto;
    padding: 15px;
    border-radius: 8px;
    line-height: 1.6;
}

.error-msg .error-icon {
    font-size: 18px;
    margin-right: 8px;
}

.retry-btn {
    background: rgba(233, 69, 96, 0.3);
    border: 1px solid #e94560;
    color: white;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-top: 10px;
    display: inline-block;
}

.retry-btn:hover {
    background: rgba(233, 69, 96, 0.5);
}

/* === CITATIONER === */

.citations {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 0.85em;
    opacity: 0.85;
}

.citations ul {
    margin: 4px 0 0 0;
    padding-left: 18px;
}

.citations li {
    margin: 2px 0;
}

.citations a {
    color: #ff6b8a;
    text-decoration: none;
}

.citations a:hover {
    text-decoration: underline;
}

/* === BILLEDER === */

.image-preview {
    max-width: 150px;
    max-height: 150px;
    margin: 5px 5px 5px 0;
    border-radius: 4px;
    border: 1px solid #0f3460;
    cursor: pointer;
}

#selected-images {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
}

/* === INPUT-OMRÅDE === */

#input-area {
    padding: 15px 20px;
    background: #16213e;
    border-top: 1px solid #0f3460;
}

#input-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

#input-row {
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #0f3460;
    border-radius: 6px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-size: 15px;
    font-family: inherit;
    resize: none;
}

#user-input:focus { outline: none; border-color: #e94560; }

#image-input { display: none; }
#doc-input { display: none; }

#image-btn {
    background: #0f3460;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

#image-btn:hover { background: #1a4a7a; }

#doc-btn {
    background: #0f3460;
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

#doc-btn:hover { background: #1a4a7a; }

#send-btn {
    background: #e94560;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

#send-btn:hover { background: #c73650; }
#send-btn:disabled { background: #666; cursor: not-allowed; }

/* === SESSION-FILER === */

#session-file-preview {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

#session-file-preview.has-files {
    display: flex;
}

.session-file-tag {
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid rgba(233, 69, 96, 0.4);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.85em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #e0e0e0;
}

.remove-session-file {
    cursor: pointer;
    opacity: 0.6;
    font-size: 14px;
}

.remove-session-file:hover {
    opacity: 1;
    color: #e94560;
}

/* === OVERLAYS === */

#menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #e94560;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    position: fixed;
    top: 5px;
    left: 5px;
    z-index: 1000;
}

#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

#drop-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(233, 69, 96, 0.15);
    border: 3px dashed #e94560;
    z-index: 900;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #e94560;
    pointer-events: none;
}

#drop-overlay.active {
    display: flex;
}

/* Prisinfo efter svar */

.cost-info {
    font-size: 0.75em;
    color: #666;
    padding: 4px 16px;
    margin: -8px 0 8px 0;
    font-style: italic;
}

/* === INFO-SIDER === */

.info-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px;
    line-height: 1.7;
}

.info-page h1 {
    color: #e94560;
    font-size: 28px;
    margin-bottom: 8px;
}

.info-page h2 {
    color: #e94560;
    font-size: 20px;
    margin: 30px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #0f3460;
}

.info-page h3 {
    color: #e0e0e0;
    font-size: 16px;
    margin: 20px 0 8px 0;
}

.info-page p {
    margin-bottom: 12px;
    color: #c0c0c0;
}

.info-page ul, .info-page ol {
    margin: 8px 0 16px 24px;
    color: #c0c0c0;
}

.info-page li {
    margin-bottom: 6px;
}

.info-page strong {
    color: #e0e0e0;
}

.info-page code {
    background: #0f3460;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #ff8a9e;
}

.info-page a {
    color: #ff6b8a;
    text-decoration: none;
}

.info-page a:hover {
    text-decoration: underline;
}

.info-card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.info-card.highlight {
    border-color: #e94560;
}

.info-tagline {
    color: #a0a0a0;
    font-style: italic;
    margin-bottom: 24px;
}

.info-back {
    display: inline-block;
    color: #a0a0a0;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 20px;
}

.info-back:hover {
    color: #e94560;
}

.info-nav {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #0f3460;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.info-nav a {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    padding: 10px 16px;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.info-nav a:hover {
    border-color: #e94560;
    color: #e94560;
}

/* === MODEL-KORT === */

.model-card {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.model-card .model-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.model-card .model-title {
    color: #e94560;
    font-size: 18px;
    font-weight: bold;
}

.model-card .model-flag {
    font-size: 20px;
}

.model-card .model-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.feature-badge {
    background: rgba(15, 52, 96, 0.6);
    border: 1px solid #0f3460;
    border-radius: 12px;
    padding: 3px 10px;
    font-size: 0.8em;
    color: #c0c0c0;
}

.feature-badge.has {
    border-color: #4caf50;
    color: #81c784;
}

.feature-badge.no {
    color: #666;
    text-decoration: line-through;
}

/* === PRIS-TABEL === */

.price-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: #16213e;
    border-radius: 8px;
    overflow: hidden;
}

.price-table th, .price-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #0f3460;
    font-size: 14px;
}

.price-table th {
    background: #0f3460;
    color: #e94560;
    font-weight: bold;
}

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

.price-table .price-cheap { color: #81c784; }
.price-table .price-mid { color: #ffb74d; }
.price-table .price-expensive { color: #e57373; }

/* === BADGES === */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    margin-right: 4px;
}

.badge-eu { background: #003399; color: #ffcc00; }
.badge-us { background: #b22234; color: white; }
.badge-warning { background: #ffb74d; color: #1a1a2e; }
.badge-good { background: #4caf50; color: white; }

/* Info-sider på mobil */
@media (max-width: 768px) {
    .info-page {
        padding: 20px 12px;
    }

    .info-page h1 {
        font-size: 22px;
    }

    .info-page h2 {
        font-size: 17px;
    }

    .price-table {
        font-size: 12px;
    }

    .price-table th, .price-table td {
        padding: 6px 8px;
    }
}

/* === RESPONSIVE === */

@media (max-width: 768px) {
    #menu-toggle {
        display: block;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        width: 260px;
        z-index: 999;
        transition: left 0.25s ease;
    }

    #sidebar.open {
        left: 0;
    }

    #sidebar-overlay.open {
        display: block;
    }

    #main {
        width: 100%;
    }

    #messages {
        padding: 50px 10px 10px 10px;
    }

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

    #input-area {
        padding: 10px;
    }

    #user-input {
        font-size: 16px;
    }

    #send-btn, #image-btn {
        padding: 12px 12px;
    }

    #welcome-screen img {
        max-width: 240px;
    }
}

/* === CHAT CONTROLS (Session 10) === */

#chat-controls {
    max-width: 800px;
    margin: 8px auto 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

#model-select-wrapper {
    flex-shrink: 0;
}

#model-select {
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #0f3460;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
}

#model-select:focus {
    outline: none;
    border-color: #e94560;
}

#model-select optgroup {
    color: #a0a0a0;
    font-style: normal;
    font-weight: bold;
}

#model-select option {
    color: #e0e0e0;
    background: #1a1a2e;
}

#web-search-toggle {
    flex-shrink: 0;
}

#web-search-toggle label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #a0a0a0;
    font-size: 0.8rem;
}

#web-search-toggle input[type="checkbox"] {
    cursor: pointer;
}

#web-search-toggle.disabled {
    opacity: 0.4;
}

#web-search-toggle.disabled label {
    cursor: not-allowed;
}

#web-search-toggle.disabled input[type="checkbox"] {
    cursor: not-allowed;
}

#provider-notice {
    font-size: 0.7rem;
    color: #888;
    flex-shrink: 0;
}

#session-cost {
    color: #666;
    font-size: 0.75rem;
    margin-left: auto;
    flex-shrink: 0;
}

/* === MARKDOWN RENDERING (Session 10) === */

.assistant-msg pre {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 0.85em;
}

.assistant-msg code {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

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

.assistant-msg code:not(pre code) {
    background: rgba(233, 69, 96, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
}

.assistant-msg ul {
    margin: 4px 0;
    padding-left: 20px;
}

.assistant-msg li {
    margin: 2px 0;
}

.assistant-msg p {
    margin: 4px 0;
}

.assistant-msg a {
    color: #ff6b8a;
    text-decoration: none;
}

.assistant-msg a:hover {
    text-decoration: underline;
}
.source-ref {
    color: #ff6b8a;
    text-decoration: none;
    font-weight: 600;
}
.orphan-ref {
    color: #6e7681;
    font-weight: 500;
    opacity: 0.7;
}

.sources-list {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #30363d;
    font-size: 13px;
    color: #a0a0a0;
}

.source-line {
    margin-top: 4px;
    line-height: 1.4;
    word-break: break-word;
}

.source-line a {
    color: #ff6b8a;
    text-decoration: none;
}

.source-line a:hover {
    text-decoration: underline;
}