/* ============================================
   CodeLens Learn Index — Styling
   ============================================ */

: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;
}

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

body {
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.7;
}

/* HEADER */
.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;
}
.header .brand { color: #e94560; font-size: 1.25rem; font-weight: bold; }
.header .brand span { color: #53d8fb; font-weight: 300; font-size: 0.88rem; }
.header .nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.header .nav-links a {
    color: #c4c4d4; text-decoration: none; padding: 7px 14px;
    border-radius: 6px; transition: all 0.3s; font-size: 0.85rem;
    display: inline-flex; align-items: center; gap: 5px;
}
.header .nav-links a:hover { background: #2a3a5e; color: #fff; }
.header .nav-links a.active { background: #2a3a5e; color: #e94560; }

.container-main { padding: 20px; max-width: 1300px; margin: 0 auto; }

/* HERO */
.hero-section {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-dark));
    border-radius: 16px;
    padding: 50px 30px;
    margin-bottom: 40px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(83,216,251,0.1) 0%, transparent 70%);
    pointer-events: none;
}
.hero-content { position: relative; z-index: 2; text-align: center; max-width: 800px; margin: 0 auto; }
.hero-content h1 {
    font-size: 2.4rem; margin-bottom: 15px;
    color: #fff; font-weight: 700;
}
.hero-content h1 .highlight {
    background: linear-gradient(135deg, #e94560, #fd971f, #53d8fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-content > p {
    color: var(--text-muted); font-size: 1rem;
    margin-bottom: 30px; line-height: 1.9;
}
.hero-content code {
    background: var(--bg-code);
    color: var(--color-css);
    padding: 2px 10px; border-radius: 6px;
    font-family: 'Courier New', monospace;
    direction: ltr; display: inline-block;
}

.hero-stats {
    display: flex; justify-content: center;
    gap: 50px; margin-bottom: 30px;
    flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-value {
    display: block;
    font-size: 2rem; font-weight: 800;
    background: linear-gradient(135deg, #e94560, #53d8fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 4px;
}

.hero-progress {
    max-width: 500px;
    margin: 0 auto;
}
.progress-track {
    height: 10px;
    background: var(--bg-code);
    border-radius: 12px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #fd971f, #53d8fb);
    border-radius: 12px;
    transition: width 1s ease;
}

/* SECTIONS */
.section-header {
    text-align: center;
    margin-bottom: 35px;
}
.section-header h2 {
    font-size: 1.7rem;
    color: #fff;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.section-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* MODULES SECTION */
.modules-section { margin-bottom: 50px; }
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.module-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 28px;
    position: relative;
    transition: all 0.4s ease;
    overflow: hidden;
}
.module-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--accent);
}
.module-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
}
.module-card:hover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%);
    pointer-events: none;
}

.module-icon {
    width: 65px; height: 65px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.9rem;
    color: var(--accent);
    margin-bottom: 18px;
    transition: all 0.3s;
}
.module-card:hover .module-icon {
    transform: scale(1.1) rotate(-5deg);
}

.module-card h3 {
    color: #fff;
    font-size: 1.4rem;
    margin-bottom: 6px;
}
.module-card > p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.module-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: 10px;
}
.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #a0a0b0;
    font-size: 0.82rem;
}
.info-item i {
    color: var(--accent);
    width: 18px;
    text-align: center;
}
.info-item code {
    color: var(--color-js);
    font-family: 'Courier New', monospace;
    font-weight: 600;
    direction: ltr;
}

.module-progress { margin-bottom: 18px; }
.module-progress .progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.module-progress .progress-info strong {
    color: var(--accent);
}
.module-progress .progress-track {
    height: 6px;
    background: var(--bg-dark);
}

.module-actions {
    display: flex;
    gap: 8px;
}
.btn-primary {
    flex: 1;
    padding: 12px 20px;
    color: #fff;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    color: #fff;
}
.btn-icon {
    width: 46px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}
.btn-icon:hover {
    background: rgba(233,69,96,0.15);
    color: var(--color-html);
    border-color: var(--color-html);
    transform: translateY(-2px);
}

/* RESET SECTION */
.reset-section {
    background: linear-gradient(135deg, rgba(233,69,96,0.08), rgba(253,151,31,0.05));
    border-radius: 16px;
    padding: 40px 30px;
    margin-bottom: 50px;
    border: 1px dashed var(--color-html);
    text-align: center;
}
.reset-icon {
    width: 70px; height: 70px;
    margin: 0 auto 18px;
    background: rgba(233,69,96,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--color-html);
}
.reset-content h3 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 10px;
}
.reset-content p {
    color: var(--text-muted);
    max-width: 550px;
    margin: 0 auto 20px;
    font-size: 0.92rem;
    line-height: 1.8;
}
.reset-content code {
    background: var(--bg-code);
    color: var(--color-css);
    padding: 2px 10px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    direction: ltr;
    display: inline-block;
}
.btn-reset-all {
    padding: 13px 30px;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 700;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-reset-all:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(233,69,96,0.4);
}

/* INFO SECTION */
.info-section { margin-bottom: 40px; }
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}
.info-card {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 22px;
    position: relative;
    transition: all 0.3s;
}
.info-card:hover {
    border-color: rgba(83,216,251,0.4);
    transform: translateY(-4px);
}
.info-num {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #e94560, #fd971f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 12px;
}
.info-card h4 {
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 6px;
}
.info-card p {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.7;
}
.info-card a {
    color: var(--color-css);
    text-decoration: none;
}
.info-card a:hover { text-decoration: underline; }
.info-card code {
    background: var(--bg-code);
    color: var(--color-js);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    direction: ltr;
    display: inline-block;
}

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(8px);
}
.modal-overlay.show { display: flex; }
.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: 480px;
    width: 100%;
    animation: modalIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    color: var(--color-js);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0 8px;
    transition: all 0.3s;
}
.close-btn:hover { color: var(--color-html); transform: rotate(90deg); }
.modal-body { padding: 22px; }
.modal-body > p {
    color: var(--text-light);
    margin-bottom: 15px;
    font-size: 0.95rem;
}
.warning-box {
    background: rgba(233,69,96,0.1);
    border-right: 3px solid var(--color-html);
    padding: 12px 15px;
    border-radius: 8px;
    color: #c4c4d4;
    font-size: 0.85rem;
    line-height: 1.7;
}
.warning-box code {
    background: var(--bg-code);
    color: var(--color-css);
    padding: 1px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    direction: ltr;
    display: inline-block;
}
.modal-footer {
    padding: 15px 22px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.btn-cancel {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    font-family: inherit;
}
.btn-cancel:hover {
    background: #2a3a5e;
    color: #fff;
}
.btn-confirm {
    padding: 10px 24px;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.3s;
    font-family: inherit;
}
.btn-confirm:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(233,69,96,0.4);
}
.btn-confirm:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 25px;
    left: 25px;
    background: #2a3a5e;
    color: var(--text-light);
    padding: 14px 24px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    z-index: 9999;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s ease;
    max-width: 400px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    font-size: 0.9rem;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: #2d5a4e; border-color: #3d7a5e; }
.toast.error { background: #5a2a4e; border-color: #7a3a5e; }
.toast.warning { background: #5a4a2e; border-color: #7a6a3e; }
.toast.info { background: #2a4a5e; border-color: #3a5a7e; }

/* RESPONSIVE */
@media (max-width: 768px) {
    .header { flex-direction: column; gap: 8px; align-items: flex-start; padding: 10px 15px; }
    .container-main { padding: 12px; }
    .hero-section { padding: 35px 20px; }
    .hero-content h1 { font-size: 1.6rem; }
    .hero-stats { gap: 25px; }
    .stat-value { font-size: 1.5rem; }
    .modules-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .hero-content h1 { font-size: 1.3rem; }
    .hero-content > p { font-size: 0.88rem; }
    .stat-value { font-size: 1.3rem; }
    .module-card { padding: 20px; }
    .btn-primary { font-size: 0.82rem; padding: 10px 15px; }
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-code); }
::-webkit-scrollbar-thumb { background: #3a4a6e; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #5a7a9a; }


/* ============================================
   PROSJEKT-VELGER
   ============================================ */
.project-selector-section {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 22px 25px;
    margin-bottom: 25px;
}

.project-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}
.ps-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ps-title i {
    color: var(--color-css);
    font-size: 1.2rem;
}
.ps-title h2 {
    font-size: 1.1rem;
    color: #fff;
    margin: 0;
}

.btn-new-project {
    padding: 9px 18px;
    background: linear-gradient(135deg, #e94560, #fd971f);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.83rem;
    font-weight: 600;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-new-project:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(233,69,96,0.4);
}

/* Current Project Display */
.current-project-display {
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(135deg, rgba(83,216,251,0.08), rgba(166,226,46,0.05));
    border: 1px solid rgba(83,216,251,0.25);
    border-radius: 14px;
    padding: 18px 22px;
    flex-wrap: wrap;
}
.cpd-icon {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    background: rgba(83,216,251,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--color-css);
    flex-shrink: 0;
}
.cpd-info {
    flex: 1;
    min-width: 150px;
}
.cpd-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 4px;
}
.cpd-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Courier New', monospace;
    direction: ltr;
    text-align: right;
    margin-bottom: 8px;
}
.cpd-files {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cpd-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.btn-cpd {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}
.btn-open {
    background: var(--color-css);
    color: #1a1a2e;
}
.btn-open:hover {
    background: #3ac0e0;
    transform: translateY(-2px);
    color: #1a1a2e;
}
.btn-reset-current {
    background: rgba(253,151,31,0.15);
    color: var(--color-js);
    border: 1px solid rgba(253,151,31,0.3);
}
.btn-reset-current:hover {
    background: var(--color-js);
    color: #1a1a2e;
    transform: translateY(-2px);
}

/* Project List Toggle */
.project-list-toggle {
    margin-top: 18px;
    padding: 12px 18px;
    background: var(--bg-dark);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.3s;
    user-select: none;
}
.project-list-toggle:hover {
    background: #232342;
    color: #fff;
}
.project-list-toggle i {
    transition: transform 0.3s;
}
.project-list-toggle i.open {
    transform: rotate(180deg);
}

/* Project List Grid */
.project-list {
    margin-top: 12px;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.project-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.mini-project-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}
.mini-project-card:hover {
    border-color: rgba(83,216,251,0.4);
}
.mini-project-card.active {
    border-color: var(--color-success);
    background: rgba(166,226,46,0.08);
}
.mpc-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(83,216,251,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-css);
    font-size: 1.1rem;
    flex-shrink: 0;
}
.mpc-info {
    flex: 1;
    min-width: 0;
}
.mpc-name {
    display: block;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    font-weight: 600;
    direction: ltr;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mpc-tag {
    display: inline-block;
    background: rgba(83,216,251,0.15);
    color: var(--color-css);
    padding: 1px 8px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 3px;
}
.mpc-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}
.mpc-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.mpc-select {
    background: rgba(166,226,46,0.15);
    color: var(--color-success);
}
.mpc-select:hover {
    background: var(--color-success);
    color: #1a1a2e;
    transform: scale(1.1);
}
.mpc-reset {
    background: rgba(253,151,31,0.15);
    color: var(--color-js);
}
.mpc-reset:hover {
    background: var(--color-js);
    color: #1a1a2e;
    transform: scale(1.1);
}
.mpc-delete {
    background: rgba(233,69,96,0.15);
    color: var(--color-html);
}
.mpc-delete:hover {
    background: var(--color-html);
    color: #fff;
    transform: scale(1.1);
}
.mpc-active-badge {
    padding: 4px 10px;
    background: var(--color-success);
    color: #1a1a2e;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Modal — Prosjekt */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(6px);
}
.modal-overlay.show { display: flex; }

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    max-width: 460px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    color: var(--color-css);
    font-size: 1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    transition: all 0.3s;
    line-height: 1;
}
.close-btn:hover {
    color: var(--color-html);
    transform: rotate(90deg);
}
.modal-body { padding: 22px; }
.modal-body label {
    display: block;
    color: var(--text-light);
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.modal-body input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-code);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    direction: ltr;
    transition: all 0.3s;
}
.modal-body input:focus {
    outline: none;
    border-color: var(--color-css);
    box-shadow: 0 0 0 3px rgba(83,216,251,0.15);
}
.modal-body small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 8px;
}
.modal-note {
    margin-top: 15px;
    padding: 12px;
    background: rgba(83,216,251,0.08);
    border-right: 3px solid var(--color-css);
    border-radius: 8px;
    color: #c4c4d4;
    font-size: 0.85rem;
}
.modal-note code {
    background: var(--bg-code);
    color: var(--color-css);
    padding: 1px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    direction: ltr;
    display: inline-block;
}
.modal-footer {
    padding: 15px 22px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.btn-cancel {
    padding: 10px 22px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
    font-family: inherit;
}
.btn-cancel:hover {
    background: #2a3a5e;
    color: #fff;
}
.btn-confirm {
    padding: 10px 24px;
    background: linear-gradient(135deg, #e94560, #fd971f);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(233,69,96,0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .current-project-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .cpd-actions { width: 100%; }
    .btn-cpd { flex: 1; justify-content: center; }
    .project-selector-header { flex-direction: column; align-items: flex-start; }
    .btn-new-project { width: 100%; justify-content: center; }
}

/* ============================================
   PROSJEKT-VELGER
   ============================================ */

.project-selector-section {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 25px;
    margin-bottom: 30px;
}

.project-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.ps-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ps-title i {
    color: var(--color-css);
    font-size: 1.3rem;
}

.ps-title h2 {
    font-size: 1.15rem;
    color: #fff;
    margin: 0;
}

.ps-count {
    background: rgba(83, 216, 251, 0.15);
    color: var(--color-css);
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-new-project {
    padding: 10px 20px;
    background: linear-gradient(135deg, #e94560, #fd971f);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-new-project:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(233, 69, 96, 0.4);
}

/* AKTIV PROSJEKT BANNER */
.active-project-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, rgba(83, 216, 251, 0.08), rgba(166, 226, 46, 0.05));
    border: 1px solid rgba(83, 216, 251, 0.25);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.apb-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-success, #a6e22e);
    font-size: 0.82rem;
    font-weight: 600;
}

.apb-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Courier New', monospace;
    direction: ltr;
}

.apb-files {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-right: auto;
}

.apb-actions {
    display: flex;
    gap: 8px;
}

.btn-banner {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.btn-banner.btn-open {
    background: var(--color-css);
    color: #1a1a2e;
}

.btn-banner.btn-open:hover {
    background: #3ac0e0;
    transform: translateY(-2px);
    color: #1a1a2e;
}

/* PROSJEKT-GRID */
.projects-list {
    margin-top: 15px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.empty-projects {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-projects i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--color-css);
    opacity: 0.5;
}

.empty-projects .hint {
    font-size: 0.8rem;
    margin-top: 8px;
}

.empty-projects code {
    background: var(--bg-code);
    color: var(--color-css);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    direction: ltr;
    display: inline-block;
}

/* PROSJEKT-KORT */
.project-card {
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 18px;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.project-card:hover {
    border-color: rgba(83, 216, 251, 0.4);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.project-card.active {
    border-color: var(--color-success, #a6e22e);
    background: linear-gradient(160deg, var(--bg-dark), rgba(166, 226, 46, 0.05));
    box-shadow: 0 0 0 1px rgba(166, 226, 46, 0.3), 0 8px 25px rgba(166, 226, 46, 0.15);
}

.pc-active-badge {
    position: absolute;
    top: -10px;
    right: 15px;
    background: var(--color-success, #a6e22e);
    color: #1a1a2e;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(166, 226, 46, 0.3);
}

.pc-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pc-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(83, 216, 251, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-css);
    font-size: 1.4rem;
    flex-shrink: 0;
    transition: all 0.3s;
}

.project-card:hover .pc-icon {
    transform: scale(1.08) rotate(-5deg);
    background: rgba(83, 216, 251, 0.2);
}

.pc-title {
    flex: 1;
    min-width: 0;
}

.pc-title h3 {
    font-size: 1rem;
    color: #fff;
    font-family: 'Courier New', monospace;
    direction: ltr;
    text-align: right;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pc-tag {
    display: inline-block;
    background: rgba(83, 216, 251, 0.15);
    color: var(--color-css);
    padding: 1px 10px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 4px;
}

.pc-files {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.file-chip {
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.66rem;
    font-family: 'Courier New', monospace;
    direction: ltr;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.file-chip.present {
    background: rgba(166, 226, 46, 0.15);
    color: var(--color-success, #a6e22e);
}

.file-chip.missing {
    background: rgba(233, 69, 96, 0.12);
    color: #e94560;
    opacity: 0.7;
}

.pc-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(42, 42, 74, 0.6);
}

.btn-card {
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-card.btn-select {
    flex: 1;
    background: var(--color-success, #a6e22e);
    color: #1a1a2e;
}

.btn-card.btn-select:hover {
    background: #8cc41a;
    transform: translateY(-2px);
}

.btn-card.btn-current {
    flex: 1;
    background: rgba(166, 226, 46, 0.15);
    color: var(--color-success, #a6e22e);
    border: 1px solid rgba(166, 226, 46, 0.3);
    cursor: default;
}

.btn-card.btn-reset {
    flex: 0 0 42px;
    background: rgba(253, 151, 31, 0.15);
    color: var(--color-js, #fd971f);
    border: 1px solid rgba(253, 151, 31, 0.25);
}

.btn-card.btn-reset:hover {
    background: var(--color-js, #fd971f);
    color: #1a1a2e;
    transform: translateY(-2px);
}

.btn-card.btn-delete {
    flex: 0 0 42px;
    background: rgba(233, 69, 96, 0.15);
    color: var(--color-html, #e94560);
    border: 1px solid rgba(233, 69, 96, 0.25);
}

.btn-card.btn-delete:hover {
    background: var(--color-html, #e94560);
    color: #fff;
    transform: translateY(-2px);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .project-selector-section { padding: 18px; }
    .active-project-banner { flex-direction: column; align-items: flex-start; }
    .apb-files { margin-right: 0; }
    .projects-grid { grid-template-columns: 1fr; }
    .project-selector-header { flex-direction: column; align-items: stretch; }
    .btn-new-project { width: 100%; justify-content: center; }
}

/* ============================================
   TOP BAR — Velg prosjekt-knapp
   ============================================ */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card, #16213e);
    border-radius: 14px;
    border: 1px solid var(--border-color, #2a2a4a);
    padding: 15px 22px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.top-bar-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.current-project-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(166, 226, 46, 0.1);
    border: 1px solid rgba(166, 226, 46, 0.3);
    padding: 10px 18px;
    border-radius: 12px;
}

.current-project-chip i {
    color: #a6e22e;
    font-size: 1.1rem;
}

.chip-label {
    color: #a0a0b0;
    font-size: 0.82rem;
}

.chip-name {
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    direction: ltr;
    font-weight: 700;
}

.btn-select-template {
    padding: 12px 26px;
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.3);
}

.btn-select-template:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(108, 92, 231, 0.5);
}

/* ============================================
   TEMPLATE MODAL (POPUP)
   ============================================ */
.template-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

.template-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.template-modal-content {
    background: #16213e;
    border-radius: 20px;
    border: 1px solid #2a2a4a;
    max-width: 950px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Modal Header */
.tm-header {
    padding: 22px 28px;
    border-bottom: 1px solid #2a2a4a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.1), transparent);
}

.tm-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tm-title i {
    color: #6c5ce7;
    font-size: 1.4rem;
}

.tm-title h3 {
    color: #fff;
    font-size: 1.25rem;
    margin: 0;
    font-weight: 700;
}

.tm-count {
    background: rgba(108, 92, 231, 0.15);
    color: #a29bfe;
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tm-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-new-template {
    padding: 10px 20px;
    background: linear-gradient(135deg, #e94560, #fd971f);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
}

.btn-new-template:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(233, 69, 96, 0.4);
}

.btn-close-modal {
    width: 38px;
    height: 38px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: #a0a0b0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-modal:hover {
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
    transform: rotate(90deg);
}

/* Modal Body */
.tm-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

.tm-empty {
    text-align: center;
    padding: 50px 20px;
    color: #75715e;
}

.tm-empty i {
    font-size: 3rem;
    color: #6c5ce7;
    opacity: 0.5;
    display: block;
    margin-bottom: 15px;
}

.tm-empty .hint {
    font-size: 0.85rem;
    margin-top: 8px;
}

.tm-empty code {
    background: #0d0d1a;
    color: #53d8fb;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    direction: ltr;
    display: inline-block;
}

/* Template Grid */
.tm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.tm-card {
    background: #0d0d1a;
    border: 2px solid #2a2a4a;
    border-radius: 14px;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.tm-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #6c5ce7;
    opacity: 0;
    transition: opacity 0.3s;
}

.tm-card:hover {
    border-color: #6c5ce7;
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(108, 92, 231, 0.25);
}

.tm-card:hover::before {
    opacity: 1;
}

.tm-card.active {
    border-color: #a6e22e;
    background: linear-gradient(160deg, #0d0d1a, rgba(166, 226, 46, 0.08));
    box-shadow: 0 0 0 1px rgba(166, 226, 46, 0.3), 0 10px 30px rgba(166, 226, 46, 0.15);
}

.tm-active-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #a6e22e;
    color: #1a1a2e;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tm-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(108, 92, 231, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a29bfe;
    font-size: 1.5rem;
    transition: all 0.3s;
}

.tm-card:hover .tm-card-icon {
    transform: scale(1.1) rotate(-8deg);
    background: rgba(108, 92, 231, 0.25);
}

.tm-card-info {
    flex: 1;
}

.tm-card-info h4 {
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 700;
    direction: ltr;
    text-align: right;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-tag {
    display: inline-block;
    background: rgba(83, 216, 251, 0.15);
    color: #53d8fb;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.tm-card-files {
    display: flex;
    gap: 6px;
    align-items: center;
}

.file-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    transition: all 0.2s;
}

.file-dot.present {
    background: #a6e22e;
    box-shadow: 0 0 8px rgba(166, 226, 46, 0.6);
}

.file-dot.missing {
    background: rgba(117, 113, 94, 0.4);
    border: 1px solid rgba(117, 113, 94, 0.6);
}

.tm-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 5px;
    padding-top: 12px;
    border-top: 1px solid rgba(42, 42, 74, 0.6);
}

.tm-btn {
    flex: 1;
    padding: 7px 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    font-family: inherit;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tm-btn-reset {
    background: rgba(253, 151, 31, 0.15);
    color: #fd971f;
    border: 1px solid rgba(253, 151, 31, 0.25);
}

.tm-btn-reset:hover {
    background: #fd971f;
    color: #1a1a2e;
    transform: translateY(-2px);
}

.tm-btn-delete {
    background: rgba(233, 69, 96, 0.15);
    color: #e94560;
    border: 1px solid rgba(233, 69, 96, 0.25);
}

.tm-btn-delete:hover {
    background: #e94560;
    color: #fff;
    transform: translateY(-2px);
}

/* ============================================
   PROJECT PREVIEW SECTION
   ============================================ */
.project-preview-section {
    margin-top: 40px;
    background: #16213e;
    border-radius: 16px;
    border: 1px solid #2a2a4a;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.preview-header {
    padding: 18px 25px;
    background: linear-gradient(135deg, #0d0d1a, #1a1a2e);
    border-bottom: 2px solid #6c5ce7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-title i {
    color: #a29bfe;
    font-size: 1.3rem;
}

.preview-title h2 {
    color: #fff;
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.preview-title code {
    background: rgba(108, 92, 231, 0.2);
    color: #a29bfe;
    padding: 3px 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    direction: ltr;
    display: inline-block;
    font-weight: 700;
}

.preview-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-preview-action {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-refresh {
    background: rgba(83, 216, 251, 0.15);
    color: #53d8fb;
    border: 1px solid rgba(83, 216, 251, 0.3);
}

.btn-refresh:hover {
    background: #53d8fb;
    color: #1a1a2e;
    transform: translateY(-2px);
}

.btn-open-new {
    background: rgba(166, 226, 46, 0.15);
    color: #a6e22e;
    border: 1px solid rgba(166, 226, 46, 0.3);
}

.btn-open-new:hover {
    background: #a6e22e;
    color: #1a1a2e;
    transform: translateY(-2px);
}

.preview-iframe-wrapper {
    background: #fff;
    height: 700px;
    position: relative;
}

.preview-iframe-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.preview-empty {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #75715e;
    background: #f8f9fa;
    padding: 40px 20px;
    text-align: center;
}

.preview-empty i {
    font-size: 4rem;
    color: #ccc;
    margin-bottom: 15px;
    display: block;
}

.preview-empty code {
    background: #e0e0e0;
    color: #333;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    direction: ltr;
    display: inline-block;
}

.preview-empty .hint {
    font-size: 0.85rem;
    margin-top: 10px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 15px;
    }
    
    .current-project-chip {
        width: 100%;
        justify-content: center;
    }
    
    .btn-select-template {
        width: 100%;
        justify-content: center;
    }
    
    .template-modal-content {
        max-height: 95vh;
        border-radius: 14px;
    }
    
    .tm-header {
        padding: 15px 18px;
    }
    
    .tm-title h3 {
        font-size: 1.05rem;
    }
    
    .tm-body {
        padding: 15px;
    }
    
    .tm-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .tm-card {
        padding: 15px 12px;
    }
    
    .tm-card-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
    
    .tm-card-info h4 {
        font-size: 0.88rem;
    }
    
    .preview-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .preview-title {
        justify-content: center;
    }
    
    .preview-actions {
        width: 100%;
    }
    
    .btn-preview-action {
        flex: 1;
        justify-content: center;
    }
    
    .preview-iframe-wrapper {
        height: 500px;
    }
}