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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

header p {
    color: #666;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1.5rem;
}

.panel h2 {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #555;
}

.form-group textarea {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    background: white;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-primary:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn-copy {
    background: #27ae60;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-copy:hover {
    background: #219a52;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.result-section {
    display: none;
}

.result-section.visible {
    display: block;
}

.language-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.language-badge.en {
    background: #e8f4fd;
    color: #2980b9;
}

.language-badge.da {
    background: #fdeaea;
    color: #c0392b;
}

.draft-container {
    position: relative;
}

.draft-text {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 1rem;
    white-space: pre-wrap;
    font-size: 0.95rem;
    max-height: 400px;
    overflow-y: auto;
}

.copy-btn-container {
    text-align: right;
    margin-top: 0.5rem;
}

.metadata-section {
    margin-top: 1.5rem;
}

.metadata-section h3 {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.questions-list {
    list-style: none;
    background: #fff3cd;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.questions-list li {
    padding: 0.25rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.questions-list li::before {
    content: "?";
    position: absolute;
    left: 0;
    color: #856404;
    font-weight: bold;
}

.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.source-tag {
    background: #d4edda;
    color: #155724;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.collapsible {
    margin-top: 1rem;
}

.collapsible-header {
    background: #e9ecef;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-header:hover {
    background: #dee2e6;
}

.collapsible-content {
    display: none;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
}

.collapsible-content.open {
    display: block;
}

.collapsible-content pre {
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: none;
}

.error-message.visible {
    display: block;
}

/* Feedback section styles */
.draft-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (max-width: 500px) {
    .draft-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .draft-actions .btn-copy {
        order: 2;
        width: 100%;
    }

    .feedback-buttons {
        order: 1;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
}

.feedback-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-feedback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: #f0f0f0;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-feedback:hover:not(:disabled) {
    transform: scale(1.1);
}

.btn-feedback:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-thumbs-up:hover:not(:disabled) {
    background: #d4edda;
    border-color: #28a745;
    color: #28a745;
}

.btn-thumbs-up.selected {
    background: #28a745;
    border-color: #28a745;
    color: white;
}

.btn-thumbs-down:hover:not(:disabled) {
    background: #f8d7da;
    border-color: #dc3545;
    color: #dc3545;
}

.btn-thumbs-down.selected {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.feedback-form {
    margin-top: 1rem;
    padding: 1rem;
    background: #fff3cd;
    border-radius: 4px;
    border: 1px solid #ffc107;
}

.feedback-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #856404;
}

.feedback-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 0.75rem;
}

.feedback-form textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

.btn-submit-feedback {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.feedback-submitted {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #d4edda;
    border-radius: 4px;
    border: 1px solid #28a745;
}

.feedback-thank-you {
    color: #155724;
    font-weight: 500;
}

/* Navigation styles */
.main-nav {
    background: #2c3e50;
    padding: 0.75rem 2rem;
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background: #3498db;
}

/* History page styles */
.filters-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.filter-group select,
.filter-group input[type="date"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 150px;
}

.btn-filter {
    padding: 0.5rem 1.25rem;
    width: auto;
}

.stats-bar {
    background: #e9ecef;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    font-size: 0.9rem;
    color: #555;
}

.stat-item strong {
    color: #2c3e50;
}

.interactions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #888;
}

.loading-state .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #ddd;
    border-top-color: #3498db;
    margin-bottom: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #888;
    background: white;
    border-radius: 8px;
}

.interaction-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1.25rem;
}

.interaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

.interaction-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.interaction-time {
    font-size: 0.9rem;
    color: #666;
}

.interaction-id {
    font-size: 0.85rem;
    color: #999;
    font-family: monospace;
}

.brand-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.brand-badge.nordiskguld {
    background: #fff3cd;
    color: #856404;
}

.brand-badge.pantsat {
    background: #cce5ff;
    color: #004085;
}

.brand-badge.auto {
    background: #e9ecef;
    color: #555;
}

.feedback-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.feedback-badge.positive {
    background: #d4edda;
    color: #155724;
}

.feedback-badge.negative {
    background: #f8d7da;
    color: #721c24;
}

.feedback-badge.none {
    background: #e9ecef;
    color: #666;
}

.interaction-section {
    margin-bottom: 0.75rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.section-header:hover {
    background: #e9ecef;
}

.section-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
}

.section-content {
    display: none;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
}

.section-content.open,
.collapsible-section.open {
    display: block;
}

.content-text {
    margin: 0;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
}

.interaction-details {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
}

.detail-group {
    margin-bottom: 0.75rem;
}

.detail-group h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
}

.questions-list-compact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.questions-list-compact li {
    padding: 0.25rem 0 0.25rem 1.25rem;
    position: relative;
    font-size: 0.9rem;
}

.questions-list-compact li::before {
    content: "?";
    position: absolute;
    left: 0;
    color: #856404;
    font-weight: bold;
}

.feedback-text-group {
    background: #fff3cd;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #ffc107;
}

.feedback-comment {
    margin: 0;
    font-size: 0.9rem;
    color: #856404;
}

.metadata-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.metadata-trigger h5 {
    margin: 0;
}

.metadata-json {
    margin: 0.5rem 0 0 0;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.8rem;
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
}

.collapsible-section {
    display: none;
}

@media (max-width: 768px) {
    .filters-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group select,
    .filter-group input[type="date"] {
        width: 100%;
    }

    .btn-filter {
        width: 100%;
    }

    .interaction-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .main-nav {
        padding: 0.5rem 1rem;
    }
}

/* Feedback editing styles */
.feedback-section {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.feedback-header h5 {
    margin: 0;
}

.btn-edit-feedback {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    background: #e9ecef;
    border: 1px solid #ddd;
    color: #555;
}

.btn-edit-feedback:hover {
    background: #dee2e6;
}

.feedback-display {
    min-height: 1.5rem;
}

.no-feedback-text {
    color: #888;
    font-style: italic;
    margin: 0;
    font-size: 0.9rem;
}

.feedback-edit-form {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
}

.feedback-buttons-edit {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.btn-feedback-option {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-feedback-option:hover {
    border-color: #aaa;
}

.btn-feedback-option.selected {
    border-color: #3498db;
    background: #e8f4fd;
    color: #2980b9;
}

.btn-feedback-option[data-value="true"].selected {
    border-color: #28a745;
    background: #d4edda;
    color: #155724;
}

.btn-feedback-option[data-value="false"].selected {
    border-color: #dc3545;
    background: #f8d7da;
    color: #721c24;
}

.feedback-text-input {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 0.75rem;
}

.feedback-text-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

.feedback-form-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-save-feedback {
    padding: 0.5rem 1rem;
    width: auto;
}

.btn-cancel-feedback {
    padding: 0.5rem 1rem;
    background: #e9ecef;
    border: 1px solid #ddd;
    color: #555;
}

.btn-cancel-feedback:hover {
    background: #dee2e6;
}

.feedback-badge-container {
    display: inline-flex;
    gap: 0.35rem;
}

/* Handled feedback styles */
.feedback-badge.handled {
    background: #d1ecf1;
    color: #0c5460;
}

.interaction-card.handled {
    border-left: 4px solid #17a2b8;
    opacity: 0.85;
}

.interaction-card.handled:hover {
    opacity: 1;
}

.handled-indicator {
    font-size: 0.8rem;
    color: #0c5460;
    background: #d1ecf1;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
}

.handled-notes {
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: #d1ecf1;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #0c5460;
}

.handled-notes strong {
    color: #0a4a54;
}

.feedback-section.feedback-handled {
    background: #e8f4f8;
    border: 1px solid #bee5eb;
}
