:root{
    --bg:#f4f6fb;
    --math:#3b82f6;
    --english:#10b981;
    --norwegian:#ef4444;
    --science:#8b5cf6;
    --social:#f59e0b;
    --pe:#06b6d4;
}

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

html,
body{
    width:100%;
    height:100%;
    overflow:hidden;
    font-family:system-ui,sans-serif;
}

body{
    background:var(--bg);
}


button:not(.homework-button):not(.menu-button) {
    padding: 5px 10px;
    margin:10px;
    border: none;
    border-radius: 8px;

    background: #2563eb;
    color: white;

    font-size: 0.75rem;
    font-weight: 600;

    cursor: pointer;

    box-shadow:
        0 1px 4px rgba(0,0,0,.12);

    transition:
        background .2s ease,
        transform .15s ease,
        box-shadow .2s ease;
}

button:not(.homework-button):not(.menu-button):hover {
    background: #1d4ed8;

    transform: translateY(-1px);

    box-shadow:
        0 4px 10px rgba(0,0,0,.16);
}

button:not(.homework-button):not(.menu-button):active {
    transform: translateY(0);

    box-shadow:
        0 1px 3px rgba(0,0,0,.12);
}

button:not(.homework-button):not(.menu-button):disabled {
    background: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}    


/* ========================
   UKER
======================== */

.weeks{
    width:100vw;
    height:100vh;
    overflow:hidden;
    position:relative;
}

.week{
    position:absolute;
    inset:0;

    width:100%;
    height:100%;

    opacity:0;
    visibility:hidden;

    transition:
        transform .35s ease,
        opacity .35s ease;

    transform:scale(.95);
}

.week.active{
    opacity:1;
    visibility:visible;
    transform:scale(1);
    z-index:10;
}

/* ========================
   DAGER
======================== */

.days{
    display:flex;
    width:500vw;
    height:100%;
    transition:transform .35s ease;
}

.day{
    width:100vw;
    padding:12px;
    overflow-y:auto;
}

.header{
    margin-bottom:6px;
}

h1{
    font-size:2rem;
    color:#111827;
}

.week-number{
    color:#6b7280;
    margin-top:2px;
}

/* ========================
   FAGKORT
======================== */

.lesson{
    margin-bottom:5px;
    padding:4px;

    border-radius:12px;

    color:white;

    box-shadow:
        0 12px 30px rgba(0,0,0,.10);
}

.subject{

    flex:1;

    font-size:1.15rem;

    font-weight:700;
}

.time{

    margin-top:0;

    font-size:.9rem;

    font-weight:600;

    white-space:nowrap;
}

.homework{
  border-top:none !important;
}

/* ========================
   FARGER
======================== */

.color-1 {
    background: linear-gradient(135deg, #60a5fa, #2563eb);
}

.color-2 {
    background: linear-gradient(135deg, #34d399, #059669);
}

.color-3 {
    background: linear-gradient(135deg, #f87171, #dc2626);
}

.color-4 {
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
}

.color-5 {
    background: linear-gradient(135deg, #fbbf24, #d97706);
}

.color-6 {
    background: linear-gradient(135deg, #22d3ee, #0891b2);
}

.color-7 {
    background: linear-gradient(135deg, #fb7185, #be123c);
}

.color-8 {
    background: linear-gradient(135deg, #4ade80, #15803d);
}

.color-9 {
    background: linear-gradient(135deg, #c084fc, #9333ea);
}

.color-10 {
    background: linear-gradient(135deg, #f97316, #c2410c);
}
/* ========================
   DAGINDIKATORER
======================== */

.dots{
    position:fixed;

    bottom:10px;
    left:50%;

    transform:translateX(-50%);

    display:flex;
    gap:8px;

    z-index:100;
}

.dot{
    width:8px;
    height:8px;

    border-radius:50%;

    background:#d1d5db;
}

.dot.active{
    background:#111827;
}

/* ========================
   UKEOVERSIKT
======================== */

.week.overview{
    opacity:1;
    visibility:visible;

    transform:
        translateY(0)
        scale(.35);

    z-index:20;
}

.week.preview-next{
    opacity:.55;
    visibility:visible;

    transform:
        translateY(38vh)
        scale(.28);

    z-index:15;
}

.week.preview-prev{
    opacity:.55;
    visibility:visible;

    transform:
        translateY(-38vh)
        scale(.28);

    z-index:15;
}

/* Kompakt innhold */

.week.overview .lesson,
.week.preview-next .lesson,
.week.preview-prev .lesson{
    min-height:50px;

    padding:10px;
    margin-bottom:6px;

    border-radius:12px;
}

.week.overview .subject,
.week.preview-next .subject,
.week.preview-prev .subject{
    font-size:.85rem;
}

.week.overview .header h1,
.week.preview-next .header h1,
.week.preview-prev .header h1{
    font-size:1rem;
}

.week.overview .week-number,
.week.preview-next .week-number,
.week.preview-prev .week-number{
    font-size:2rem;
    font-weight:800;
    color:#111827;
    text-align:center;
    margin:12px 0 20px 0;
    letter-spacing:.08em;
}

.week.overview .week-number{
    background:white;
    width:max-content;
    margin:0 auto 20px;
    padding:10px 20px;
    border-radius:999px;
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
}


.week.overview .time,
.week.overview .homework,
.week.preview-next .time,
.week.preview-next .homework,
.week.preview-prev .time,
.week.preview-prev .homework{
    display:none;
}

.week.overview::after{
    content:"";

    position:absolute;
    inset:0;

    background:
        rgba(255,255,255,.15);

    pointer-events:none;
}

/* ========================
   LANDSKAP PÅ PC/MAC
======================== */

@media (orientation:landscape) and (min-width:901px){

    .day{
        width:auto;
        padding:12px;
    }


    .subject{
        flex:1;
        min-width:0;
        overflow:hidden;
        white-space:nowrap;
        text-overflow:ellipsis;
        font-size:1rem;
    }
    
    .days{
        width:auto;

        display:grid;
        grid-template-columns:
            repeat(5,1fr);

        gap:12px;

        padding:12px;

        transform:none !important;
    }

    .lesson-short{
        min-height:40px !important;
    }

    .lesson-long{
        min-height:60px !important;
    }
    
    .time{
        font-size:.8rem;
    }
    
    h1{
        font-size:1.2rem;
        text-align:center;
    }

    .week-number{
        text-align:center;
        font-size:.8rem;
    }

    .lesson-homework{
        font-size:.75rem;
    }
    
    .dots{
        display:none;
    }
}

/* ========================
   TELEFON LANDSKAP
======================== */

@media (orientation:landscape) and (max-width:900px){

.block-course-row {
    margin-bottom: 2px !important;
}


.modal-card div {
    margin: 0px;
}
    
.modal-card button {
    margin: 2px 0 2px;
}
    
.modal-card h3,
.modal-card h4,
.modal-card label{
    display: none !important;
}  
    
.teacher-homework-link {
    font-size: 0.4rem !important;
}

.teacher-homework-preview {
    font-size: 0.4rem !important;
}
    
.lesson-homework-preview{

    font-size:.45rem;

    margin-top:1px;

    opacity:.85;

    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
    
    .late-start{
        font-size:0.8rem !important;
        font-weight: 200 !important;
        letter-spacing: 6px !important;
        margin-top:-5px !important;
        margin-bottom:-3px !important;
        line-height:1 !important;
    }
    
    .lunch-break{
        font-size:0.8rem !important;
        font-weight: 200 !important;
        letter-spacing: 6px !important;
        margin-top:-5px !important;
        margin-bottom:-3px !important;
        line-height:1 !important;
    }
   
    .lesson-short{
        min-height:25px !important;
    }

    .lesson-long{
        min-height:40px !important;
    }
    
    .lesson-top{
        gap:4px;
    }
    
    .days{
        width:auto;
        display:grid;
        grid-template-columns:repeat(5,1fr);

        gap:3px;
        padding:3px;

        transform:none !important;
    }

    .day{
        width:auto;
        padding:3px;
    }

    .header{
        margin-bottom:2px;
        text-align:center;
        display:flex;
        justify-content:center;
        align-items:center;
        gap:4px;
    }

    /* Dag + uke veldig kompakt */

    h1{
        font-size:.7rem;
        line-height:1.1;
        text-align:center;
        margin:0;
    }

    .week-number{
        font-size:.7rem;
        margin:0;
        display:inline;
        color:#6b7280;
    }

    /* Små fagkort */

.lesson{
    min-height:30px;
    padding:2px 4px;
    margin-bottom:2px;
    border-radius:8px;
    overflow:hidden;
}

    /* Fagnavn */

    .subject{
        font-size:.7rem;
        font-weight:700;
        line-height:1;
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
    }

    
    .teacher{
        font-size:.5rem;
        text-align: right;
        margin: 1px 0 -5px;
   /* Skjul lærer 
        display:none !important; */
    }

    .room-teacher{
        display:flex;
        justify-content:flex-end;
        align-items:center;
        gap:8px;
    }

    .room{
        font-size:.5rem;
        font-style:italic;
        text-align: left;
        margin: 1px 0 -5px;
    }
   
    /* Skjul lekse-knappen */

    .homework-button{
        display:none !important;
    }

    /* Tid mindre */

    .time{
        font-size:.6rem;
        margin-top:2px;
    }

    
    .assignment,
    .homework,
    .assignment-note{
        font-size:.6rem;

        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
    }

    .assignment{
        margin-top:2px;
        padding:2px 4px;
    }

    .dots{
        display:none;
    }

    /* Gjør prøve-merket litt mindre */

    .exam-lesson::before{
        font-size:1rem;
        letter-spacing:2px;
    }
/*
    .tentamen-card .subject {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    }

    .tentamen-card .homework {
        font-size: 0.6rem !important;
        line-height: 1 !important;
    }
    */
}

/* ========================
   REGISTRERING
======================== */

.register-screen{

    position:fixed;
    inset:0;

    display:flex;
    justify-content:center;
    align-items:center;

    background:var(--bg);

    z-index:9999;
}

.register-card{

    width:min(420px,90vw);

    background:white;

    border-radius:24px;

    padding:24px;

    box-shadow:
        0 12px 30px rgba(0,0,0,.10);
}

.register-card h2{

    margin-bottom:16px;
}

.register-card input,
.register-card select{

    width:100%;

    padding:14px;

    margin-bottom:12px;

    border-radius:12px;

    border:1px solid #ddd;

    font-size:1rem;
}

.register-card button{

    width:100%;

    padding:14px;

    border:none;

    border-radius:12px;

    background:#2563eb;

    color:white;

    font-size:1rem;
}

/* ========================
   MENY
======================== */

.menu-button{

    position:fixed;

    top:16px;
    right:16px;

    width:40px;
    height:40px;

    border-radius:50%;

    border:none;

    background: rgba(255, 255, 255, 0.65);


    box-shadow:
        0 6px 18px rgba(0,0,0,.12);

    z-index:300;

    font-size:1rem;
}
/* ========================
   MODAL
======================== */

.modal{

    position:fixed;

    inset:0;
    background: rgba(30, 41, 59, .20);
    backdrop-filter: blur(4px);

    display:flex;

    justify-content:center;
    align-items:center;

    z-index:1000;
}

.modal-card {
    background: linear-gradient(
        180deg,
        #ffffff 0%,
        #f8fbff 100%
    );
    border: 1px solid #dbeafe;
    box-shadow: 0 5px 10px rgba(0,0,0,.10);
    border-radius: 8px;
    padding: 6px 12px 6px 12px;
}
/* ========================
   FERIE
======================== */

.holiday-card{
    min-height:80%;
    background:
        linear-gradient(
            135deg,
            #93c5fd,
            #60a5fa
        );

    color:white;
}

.dayoff-card{
    min-height:80%;
    background:
        linear-gradient(
            135deg,
            #93c5fd,
            #60a5fa
        );

    color:white;
}
/* ========================
   OPPGAVER
======================== */

.assignment{

    margin-top:12px;

    padding:10px;

    border-radius:12px;

    background:
        rgba(255,255,255,.15);
}

.assignment-title{

    font-weight:700;
}

.assignment-note{

    margin-top:6px;

    font-size:.9rem;

    opacity:.95;
}
.assignment-status{

    display:inline-block;

    margin-top:8px;

    padding:4px 10px;

    border-radius:999px;

    font-size:.75rem;

    background:
        rgba(255,255,255,.2);
}

.status-open{

    background:#ef4444;
}

.status-started{

    background:#f59e0b;
}

.status-done{

    background:#10b981;
}

.teacher-mode.menu-button{
    background: rgba(180, 35, 35, 0.85);
    color:white;
}

.admin-button{

    position:fixed;

    top:80px;
    right:16px;

    z-index:301;

    border:none;

    border-radius:12px;

    padding:12px 16px;

    background: rgba(220, 38, 38, 0.85);

    color:white;

    font-weight:600;
}

.room-teacher{

    display:flex;
    align-items:center;
    gap:8px;

    margin-top:4px;
}

.room{

    font-weight:700;
    margin:0;
}

.teacher{

    font-style:italic;
    margin:0;
}

.lesson-top{

    display:flex;

    justify-content:space-between;

    align-items:center;

    gap:12px;
}

.homework-button{
    z-index:100;
    position:absolute;

    right:5px;
    bottom:5px;

    width:20px;
    height:20px;

    border:none;

    border-radius:50%;

    background:
        rgba(255,255,255,.2);

    color:white;
    font-size:.7rem;
    cursor:pointer;
}

.homework-button:hover{

    background:
        rgba(
            255,
            255,
            255,
            .35
        );
}

.lesson{

    position:relative;
}


.lesson-long{
    min-height:80px;
}

.lesson-short{
    min-height:60px;
}






.exam-lesson {
    border: 6px solid #ff0000 !important;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

.exam-lesson::before {

    content: "PRØVE";

    position: absolute;

    top: 50%;
    left: 50%;

    transform:
        translate(-50%, -50%)
        rotate(-10deg);

    font-size: 1.5rem;
    font-weight: 900;

    color: rgba(0,0,0,0.45);

    letter-spacing: 8px;

    pointer-events: none;

    z-index: 1;
}

.late-start{
    opacity: .6;
    text-align: center;
    margin:-7px 0 7px 0;
    padding: 0;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 6px;
    line-height: 0.5;
    color: #6b7280;
}

.lunch-break{
    margin:-7px 0 7px 0;
    opacity: .6;
    text-align:center;
    font-size:1.1rem;
    font-weight:500;
    letter-spacing:6px;
    line-height: 0.5;
    color:#6b7280;
}

.teacher-only{
    visibility:hidden;
    opacity:0;
    pointer-events:none;
}

.roomInvisible{
    display: none !important;
    visibility:hidden !important;
    opacity:0 !important;
    pointer-events:none !important;
}

.teacherInvisible{
    display: none !important;
    visibility:hidden !important;
    opacity:0 !important;
    pointer-events:none !important;
}


.teacher-only.teacher-active{

    visibility:visible;
    opacity:1;
    pointer-events:auto;
}

.lesson-homework-preview{

    margin-top:2px;

    font-size:.65rem;

    opacity:.9;

    cursor:pointer;

    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.homework-viewer-card{

    width: min(90vw, 600px);
    height: auto;
    max-height: 80vh;
    overflow-y: auto;

    padding:16px;

    border-radius:16px;

    background:linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;

    color:#111827;

    box-shadow:
        0 20px 50px
        rgba(
            0,
            0,
            0,
            .25
        );
}

.homework-viewer-text{

    margin-top:24px;

    background:
        rgba(
            255,
            255,
            255,
            .7
        );

    padding:24px;

    border-radius:16px;

    font-size:1.1rem;

    line-height:1.8;

    white-space:pre-wrap;

    box-shadow:
        inset 0 1px 2px
        rgba(
            255,
            255,
            255,
            .8
        );
}

.homework-viewer-card h2{

    color:#1d4ed8;

    font-size:2rem;

    margin-bottom:12px;
}

.exam-title {
    display: inline-block;
    margin-top: 2px;
    padding: 2px 6px;

    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;

    color: #b42318;
    background: rgba(180, 35, 24, 0.10);

    border-radius: 999px;

    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tentamen-card {
    min-height: 50vh;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    margin: 1rem;

    padding: 2rem;

    border-radius: 20px;

    background: linear-gradient(
        180deg,
        #fff8e1,
        #ffe082
    );

    border: 3px solid #ffb300;

    text-align: center;

    box-sizing: border-box;
}

.tentamen-card .subject {
    font-size: clamp(1rem, 2vw, 2rem);
    font-weight: 700;

    margin-bottom: 1rem;
    color: #5d4037;

    max-width: 100%;
    min-width: 0;

    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
    line-height: 1.25;
}

//Særbehandling på smale skjermer
@media (max-width: 600px) {
    .tentamen-card {
        padding: 1.25rem;
    }

    .tentamen-card .subject {
        font-size: 1.25rem;
    }
}
//Særbehanding slutt

.tentamen-card .homework {
    font-size: clamp(0.4rem, 1.2vw, 1.5rem);
    line-height: 1.6;

    color: #333;
}

.progress {
    width: 300px;
    height: 10px;
    background: #ddd;
    border-radius: 10px;
    overflow: hidden;
}

#progressBar {
    width: 0%;
    height: 100%;
    background: linear-gradient(
        90deg,
        #0078d4,
        #42b0ff
    );
    transition: width .2s;
}

#loader {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(255,255,255,0.9);
}

.admin-only {

    display: none;
}

.admin-only.admin-active {

    display: block;
}

.teacher-homework-preview {

    margin: 1px;

    padding: 1px;

    border-radius: 2px;

    background: #fff3c2;

    color: #6a4b00;

    font-size: 0.7rem;
}

.teacher-homework-card {

    background: #fff3c2;

    border-radius: 12px;

    padding: 12px;

    margin-bottom: 12px;

    border: 2px solid #f0c04a;
}

.teacher-homework-title {

    font-weight: bold;

    font-size: 1rem;

    margin-bottom: 8px;

    color: #7a5300;
}

.teacher-homework-text {

    line-height: 1.5;

    color: #4d3c11;
}

.student-homework-title {

    font-weight: bold;

    margin-bottom: 8px;
}

.teacher-homework-link {
    font-size: 0.7rem;
    /* display: inline-block; */
    margin-top: 2px;
    margin-bottom: 2px;

    padding: 2px 2px;

    background: #0078d4;
    color: white;

    text-decoration: none;
    border-radius: 2px;

        flex:1;
        min-width:0;
        overflow:hidden;
        white-space:nowrap;
        text-overflow:ellipsis;
}


.teacher-homework-link:hover {

    background: #106ebe;
}




#requests {
    padding: 12px;
}

.request-card {

    background: white;
    border-radius: 12px;

    padding: 16px;

    margin-bottom: 12px;

    box-shadow:
        0 2px 6px
        rgba(0,0,0,.1);
}

.request-card h3 {
    margin: 0 0 8px;
}

.request-card p {
    margin: 0 0 12px;
    word-break: break-word;
}

.request-card button {

    width: 100%;

    height: 48px;

    border: none;

    border-radius: 8px;

    background: #2e7d32;

    color: white;

    font-size: 16px;
}

.field-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.field-group input {
    width: 100%;
    box-sizing: border-box;
}


#blockCourseSubject {
    width: 100%;
}

#blockCourseRoom {
    width: 120px;
}

.block-course-row {
    display: flex;
    align-items: flex-end;
    gap: 20px;
}

.field-group:first-child {
    flex: 1;
}

#homeworkText,
#teacherHomeworkText {
    text-align: left;
    vertical-align: top;
    padding: 8px;
    box-sizing: border-box;
}
