/* ====== CodeLens - Felles stil for læringsplattformen ====== */
/* Denne filen inneholder all styling for selve læringsplattformen */

/* ====== ROOT VARIABLES ====== */
:root {
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --bg-code: #0d0d1a;
    --border-color: #2a2a4a;
    --text-light: #e0e0e0;
    --text-muted: #75715e;
    --color-html: #e94560;
    --color-css: #53d8fb;
    --color-js: #fd971f;
    --shadow: 0 8px 25px rgba(0,0,0,0.6);
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* ====== RESET ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ====== HEADER ====== */
.codelens-header {
    background: var(--bg-card);
    padding: 12px 25px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.codelens-header .brand {
    color: var(--color-html);
    font-size: 1.3rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.codelens-header .brand i {
    font-size: 1.4rem;
}

.codelens-header .brand span {
    color: var(--color-css);
    font-weight: 300;
    font-size: 0.9rem;
}

.codelens-header .nav-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.codelens-header .nav-links a {
    color: #c4c4d4;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.codelens-header .nav-links a:hover {
    background: #2a3a5e;
    color: #fff;
    transform: translateY(-1px);
}

.codelens-header .nav-links a.active {
    background: #2a3a5e;
    color: var(--color-html);
}

/* ====== MAIN CONTAINER ====== */
.codelens-container {
    padding: 20px;
    max-width: 1600px;
    margin: 0 auto;
    flex: 1;
    width: 100%;
}

/* ====== TOOLBAR ====== */
.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    align-items: center;
}

.toolbar .btn {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar .btn:hover {
    transform: scale(1.03);
}

.toolbar .btn-primary {
    background: var(--color-html);
    color: #fff;
}
.toolbar .btn-primary:hover {
    background: #c73652;
}

.toolbar .btn-success {
    background: var(--color-css);
    color: #1a1a2e;
}
.toolbar .btn-success:hover {
    background: #3ac0e0;
}

.toolbar .btn-warning {
    background: var(--color-js);
    color: #1a1a2e;
}
.toolbar .btn-warning:hover {
    background: #e0861a;
}

.toolbar .btn-danger {
    background: #e94560;
    color: #fff;
}
.toolbar .btn-danger:hover {
    background: #c73652;
}

.toolbar .btn-outline {
    background: transparent;
    color: #c4c4d4;
    border: 1px solid var(--border-color);
}
.toolbar .btn-outline:hover {
    background: #2a3a5e;
    color: #fff;
}

.toolbar .status {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar .status .saved {
    color: var(--color-css);
}
.toolbar .status .unsaved {
    color: var(--color-js);
}

/* ====== EDITOR GRID ====== */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.editor-grid .full-width {
    grid-column: 1 / -1;
}

/* ====== EDITOR PANEL ====== */
.editor-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
}

.editor-panel:hover {
    border-color: #3a4a6e;
}

.editor-panel .panel-header {
    background: var(--bg-code);
    padding: 8px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-panel .panel-header .label {
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-panel .panel-header .label.html { color: var(--color-html); }
.editor-panel .panel-header .label.css { color: var(--color-css); }
.editor-panel .panel-header .label.js { color: var(--color-js); }

.editor-panel .panel-header .badge {
    font-size: 0.65rem;
    color: var(--text-muted);
    background: var(--bg-dark);
    padding: 2px 10px;
    border-radius: 12px;
}

.editor-panel textarea {
    width: 100%;
    height: 220px;
    background: var(--bg-code);
    color: #f8f8f2;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    padding: 15px;
    border: none;
    outline: none;
    resize: vertical;
    tab-size: 4;
    transition: var(--transition);
}

.editor-panel textarea:focus {
    box-shadow: inset 0 0 0 2px var(--color-html);
}

.editor-panel textarea.html-editor:focus { box-shadow: inset 0 0 0 2px var(--color-html); }
.editor-panel textarea.css-editor:focus { box-shadow: inset 0 0 0 2px var(--color-css); }
.editor-panel textarea.js-editor:focus { box-shadow: inset 0 0 0 2px var(--color-js); }

.editor-panel textarea::selection {
    background: #e9456040;
    color: #fff;
}

/* ====== PREVIEW ====== */
.preview-container {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    height: 450px;
    position: relative;
}

.preview-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.preview-container .preview-label {
    position: absolute;
    top: 10px;
    right: 15px;
    background: var(--bg-dark);
    color: var(--text-muted);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    opacity: 0.6;
    pointer-events: none;
}

/* ====== INFO BANNER ====== */
.info-banner {
    margin-top: 15px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    align-items: center;
}

.info-banner .color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 4px;
}

.info-banner .color-dot.html { background: #f92672; }
.info-banner .color-dot.css { background: #a6e22e; }
.info-banner .color-dot.js { background: #fd971f; }
.info-banner .color-dot.value { background: #e6db74; }
.info-banner .color-dot.comment { background: #75715e; }

.info-banner .status-text {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-banner .status-text .online {
    color: var(--color-css);
}
.info-banner .status-text .offline {
    color: var(--color-js);
}

/* ====== TOAST MESSAGES ====== */
.toast-message {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #2a3a5e;
    color: var(--text-light);
    padding: 14px 28px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    z-index: 9999;
    animation: slideUp 0.3s ease;
    max-width: 450px;
    box-shadow: var(--shadow);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-message.success { background: #1a3a2e; border-color: #2d5a4e; }
.toast-message.error { background: #3a1a2e; border-color: #5a2a4e; }
.toast-message.warning { background: #3a2a1a; border-color: #5a4a2e; }
.toast-message.info { background: #1a2a3a; border-color: #2a4a5e; }

.toast-message .toast-icon {
    font-size: 1.2rem;
}

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

/* ====== RESPONSIVE ====== */
@media (max-width: 992px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .codelens-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        padding: 10px 15px;
    }
    
    .codelens-container {
        padding: 10px;
    }
    
    .editor-panel textarea {
        height: 150px;
    }
    
    .preview-container {
        height: 350px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar .status {
        margin-left: 0;
        text-align: center;
        justify-content: center;
    }
    
    .info-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .info-banner .status-text {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .codelens-header .nav-links {
        width: 100%;
        justify-content: flex-start;
    }
    
    .codelens-header .nav-links a {
        font-size: 0.75rem;
        padding: 4px 10px;
    }
    
    .toolbar .btn {
        font-size: 0.75rem;
        padding: 6px 14px;
        justify-content: center;
    }
    
    .preview-container {
        height: 280px;
    }
    
    .toast-message {
        bottom: 15px;
        right: 15px;
        left: 15px;
        max-width: none;
        font-size: 0.85rem;
        padding: 12px 18px;
    }
}

/* ====== SCROLLBAR ====== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-code);
}

::-webkit-scrollbar-thumb {
    background: #3a4a6e;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5a7a9a;
}

/* ====== UTILITY ====== */
.text-html { color: var(--color-html); }
.text-css { color: var(--color-css); }
.text-js { color: var(--color-js); }
.text-muted { color: var(--text-muted); }

.bg-code { background: var(--bg-code); }
.bg-card { background: var(--bg-card); }

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

.gap-1 { gap: 5px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }

.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }