/* 
 * direct-styles.css
 * Stilar för AI ChatBot - Direktversion
 */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --direct-badge: #e67e22;
    --bg-color: #fff;
    --text-color: #333;
    --input-bg: #f5f5f5;
    --border-color: #ddd;
    --message-user-bg: #e1f5fe;
    --message-system-bg: #f5f5f5;
    --message-error-bg: #ffebee;
    --thinking-color: #3498db;
    --modal-bg: rgba(0, 0, 0, 0.6);
    --modal-content-bg: #fff;
    --modal-border: #ddd;
    --tab-active-bg: #e1f5fe;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --modal-text: #2d3436;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
}

/* Mörkt tema */
.dark-mode {
    --primary-color: #1a1a2e;
    --secondary-color: #4361ee;
    --accent-color: #e63946;
    --direct-badge: #e67e22;
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --input-bg: #2a2a2a;
    --border-color: #444;
    --message-user-bg: #1e3a5f;
    --message-system-bg: #2a2a2a;
    --message-error-bg: #391f1f;
    --thinking-color: #4361ee;
    --modal-bg: rgba(0, 0, 0, 0.8);
    --modal-content-bg: #1e1e1e;
    --modal-border: #444;
    --tab-active-bg: #1e3a5f;
    --demo-color: #ff7675;
    --error-color: #d63031;
    --success-color: #00b894;
    --demo-color: #e17055;
    --modal-text: #f1f2f6;
    --warning-color: #fd9644;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 70px); /* Justerat för footern */
    display: flex;
    flex-direction: column;
}

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

header h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
}

/* Direktversion badge */
.direct-mode-badge {
    font-size: 0.65rem;
    background-color: var(--direct-badge);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    vertical-align: super;
    margin-left: 8px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* Header controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Info Button */
.info-button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: var(--transition);
}

.info-button:hover {
    background-color: rgba(108, 92, 231, 0.1);
}

/* Mörkt/ljust tema toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Chattområde */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
    overflow: hidden;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 300px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    animation: fadeIn 0.3s ease;
}

.message.user {
    align-self: flex-end;
    background-color: var(--message-user-bg);
    border-bottom-right-radius: 0;
}

.message.system {
    align-self: flex-start;
    background-color: var(--message-system-bg);
    border-bottom-left-radius: 0;
}

.message.error {
    align-self: center;
    background-color: var(--message-error-bg);
    color: var(--error-color);
    padding: 8px 16px;
    font-size: 0.9rem;
}

.message-content {
    word-break: break-word;
}

.thinking {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background-color: var(--message-system-bg);
    border-radius: var(--border-radius);
    border-bottom-left-radius: 0;
}

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

.thinking span:nth-child(1) {
    animation-delay: 0s;
}

.thinking span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking span:nth-child(3) {
    animation-delay: 0.4s;
}

.input-area {
    display: flex;
    gap: 10px;
}

textarea {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px;
    font-size: 1rem;
    resize: none;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 0 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

button:hover {
    background-color: var(--primary-color);
}

button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #777;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}

.api-info {
    font-style: italic;
}

.api-info.no-key {
    color: var(--warning-color);
}

.api-info.error-mode {
    color: var(--error-color);
}

.api-info.success-mode {
    color: var(--success-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    overflow-y: auto;
}

.modal.open {
    display: block;
    opacity: 1;
    visibility: visible;
    animation: modalAppear 0.3s forwards;
}

.modal-content {
    background-color: var(--modal-content-bg);
    color: var(--modal-text);
    margin: 5% auto;
    width: 80%;
    max-width: 700px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-height: 85vh;
    overflow-y: auto;
    animation: modalAppear 0.3s;
}

.smaller-modal {
    max-width: 500px;
}

@keyframes modalAppear {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.close, .api-modal-close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #777;
    transition: color 0.2s;
}

.close:hover, .api-modal-close:hover {
    color: var(--accent-color);
}

.tabs {
    display: flex;
    gap: 5px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--modal-border);
}

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

.tab-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.tab-btn.active {
    background-color: var(--tab-active-bg);
    color: var(--primary-color);
    font-weight: 600;
}

.modal-body {
    padding: 0;
}

.tab-content {
    display: none;
    padding: 20px;
}

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

.tab-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.tab-content p {
    margin-bottom: 15px;
    line-height: 1.5;
}

.tab-content ul, .tab-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.tab-content li {
    margin-bottom: 5px;
}

.tab-content code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

.tab-content pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9em;
    margin-bottom: 15px;
}

/* API-nyckel form */
.api-key-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.api-key-form label {
    font-weight: bold;
    margin-bottom: -10px;
}

.api-key-form input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--text-color);
}

.key-buttons {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.secondary-button {
    background-color: #95a5a6;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.api-note {
    font-size: 0.8rem;
    font-style: italic;
    margin-top: -5px;
}

/* Footer och knappar */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 10;
    transition: var(--transition);
}

.footer-btn {
    padding: 8px 15px;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    text-align: center;
}

.footer-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.primary-btn {
    background-color: var(--secondary-color);
    color: white;
}

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

/* Här skedde en uppdatering: Lade till specifik stil för info-knappen */
.info-btn {
    background-color: #3498db;
    color: white;
}

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

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

@keyframes thinking {
    0%, 100% { transform: scale(0.5); opacity: 0.3; }
    50% { transform: scale(1.0); opacity: 1; }
}

/* Responsiv design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        min-height: calc(100vh - 130px);
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .message {
        max-width: 90%;
    }
    
    .modal-content {
        width: 95%;
        margin: 3% auto;
        max-height: 95vh;
    }
    
    .footer {
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 15px;
    }
    
    .footer-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .key-buttons {
        flex-direction: column;
    }
} 