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

html,
body {
    width: 100%;
    height: 100%;
}

body {
    overflow: hidden;
    font-family: 'Gill Sans', 'Gill Sans MT', 'Calibri', 'Trebuchet MS', sans-serif;
}

.background {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden; 
    background: #000;
}

.background::before {
    content: "";
    position: absolute;
    top: -15px;
    left: -15px;
    width: calc(100% + 30px);
    height: calc(100% + 30px);

    background-image: url("utilities/imgs/professor_os.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    isolation: isolate;
    filter: blur(6px);
    animation: clearBackground 3.5s ease forwards;
    z-index: 0;
}

@keyframes clearBackground {
    0% {
        filter: blur(6px);
    }

    70% {
        filter: blur(6px);
    }

    100% {
        filter: blur(0);
    }
}

#wrapper {
    position: absolute;
    top: 50%;
    left: 50%;

    width: 100px;
    height: 100px;

    transform: translate(-50%, -50%);

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

    z-index: 10;

    animation: hideLoader 0.5s ease 3.5s forwards;
}
 
.loader {
    width: 70px;
    height: 70px;

    border: 5px solid rgba(255, 255, 255, 0.25);
    border-top-color: rgb(255, 4, 0);
    border-radius: 50%;

    animation: rotation 3.5s linear forwards;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    84% {
        transform: rotate(500deg);
    }

    95% {
        transform: rotate(1200deg);
        border-color: #fff;
        border-top-color: rgb(255, 4, 0);
    }

    100% {
        transform: rotate(1800deg);
        border-color: #fff;
    }
}

@keyframes hideLoader {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

.container {
    position: absolute;
    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    text-align: center;
    color: white;

    z-index: 5;

    opacity: 0;
    animation: showTitle 1s ease 3.5s forwards;
}

.container h1 {
    font-size: 60px;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 700;

    text-shadow:
        0 0 10px rgba(0, 0, 0, 0.8),
        0 0 25px rgba(0, 0, 0, 0.6);
}

@keyframes showTitle {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 768px) {
    .container h1 {
        font-size: 35px;
        letter-spacing: 5px;
    }

    .loader {
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 480px) {
    .container h1 {
        font-size: 25px;
        letter-spacing: 3px;
    }
}

.app {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 20;
    display: block; 
    gap: 25px;
    opacity: 0;
    animation: showApps 0.8s ease 3.5s forwards;
    justify-items: center;
    align-items: center;
}

.app img {
    width: 65px;
    height: 65px;
    object-fit: contain;
    cursor: pointer;
}

.app {
    opacity: 0;
    animation: showApps 0.8s ease 3.5s forwards;
}

@keyframes showApps {
    to {
        opacity: 1;
    }
}
.app-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 90px;
    text-align: center;
    cursor: grab;
    user-select: none;
}

.app-item img {
    width: 65px;
    height: 65px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.app-item p {
    color: white;
    font-size: 14px;
    text-shadow: 1px 1px 4px black;
}

.app-item:hover img {
    transform: scale(1.1);
}
 
.app-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 320px;
    padding-bottom: 15px;

    background: #171717;
    color: white;
    border: 1px solid #a51c24;
    border-radius: 10px;
    box-shadow: 0 10px 40px #0009;

    z-index: 100;
    display: none;
}
.app-window {
    resize: both;
    overflow: auto;

    min-width: 280px;
    min-height: 200px;

    max-width: 95vw;
    max-height: 90vh;
}

.app-window img,
.app-window canvas {
    max-width: 100%;
}
/* Window title bar */
.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor:grab;
    user-select:none;
    touch-action:none;
    padding: 12px 15px;
    background: #8b0000;
    border-radius: 9px 9px 0 0;
    font-weight: bold;
}

.window-header:active{
    cursor: grabbing;
}
.window-controls {
    display: flex;
    gap: 8px;
}

.window-controls button {
    width: 28px;
    height: 26px;
    border: none;
    color: white;
    background: #333;
    cursor: pointer;
    border-radius: 4px;
}

#closeCalculator:hover {
    background: #e00000;
}

#minimizeCalculator:hover {
    background: #555;
}

/* Calculator display */
.calculator-body {
    padding: 15px;
}

#calcDisplay {
    width: 100%;
    height: 60px;
    margin-bottom: 12px;
    padding: 10px;

    background: #292929;
    color: white;
    border: 1px solid #444;
    border-radius: 5px;

    text-align: right;
    font-size: 27px;
}

/* Calculator keypad */
.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.calculator-buttons button {
    height: 48px;
    border: none;
    border-radius: 5px;

    background: #303030;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.calculator-buttons button:hover {
    background: #505050;
}

.calculator-buttons button[data-operator] {
    background: #702126;
}

.calculator-buttons .equals {
    background: #c51f2b;
    grid-row: span 2;
    height: auto;
}

.calculator-buttons .zero {
    grid-column: span 2;
}


/* Calendar window */
.calendar-window {
    width: 360px;
    max-width: calc(100vw - 24px);
    padding-bottom: 15px;
}

.calendar-body {
    padding: 16px;
}

.calendar-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.calendar-heading h2 {
    font-size: 20px;
    color: white;
}

.calendar-heading button {
    background: #702126;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 7px 10px;
    cursor: pointer;
}

.calendar-weekdays,
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
    text-align: center;
}

.calendar-weekdays span {
    color: #ff7777;
    font-size: 12px;
    padding: 7px 0;
}

.calendar-days button {
    min-width: 0;
    aspect-ratio: 1;
    border: none;
    border-radius: 5px;
    background: #303030;
    color: white;
    cursor: pointer;
}

.calendar-days button:hover {
    background: #702126;
}

.calendar-days button.today {
    border: 1px solid #ff3434;
}

.calendar-days button.selected {
    background: #c51f2b;
}

.calendar-days button:focus-visible {
    outline: 2px solid white;
}

#selectedDate {
    color: #ddd;
    font-size: 13px;
    margin-top: 16px;
    text-align: center;
}

.today-button {
    display: block;
    margin: 12px auto 0;
    padding: 8px 18px;
    background: #8b0000;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}


/* Paint */
#paintWindow {
    width: 660px;
    max-width: calc(100vw - 20px);
}

.paint-body {
    padding: 12px;
}

.paint-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 13px;
}

.paint-toolbar label {
    display: flex;
    align-items: center;
    gap: 5px;
}

.paint-toolbar button,
.files-toolbar button {
    padding: 7px 10px;
    background: #702126;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#paintCanvas {
    display: block;
    width: 100%;
    height: auto;
    background: white;
    border-radius: 4px;
    cursor: crosshair;
    touch-action: none;
}

/* Files */
#filesWindow {
    width: 540px;
    max-width: calc(100vw - 20px);
}

.files-body {
    padding: 14px;
}

.files-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

#filesPath {
    color: #ff7777;
    margin: 15px 0 10px;
    font-size: 13px;
}

.files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
    min-height: 180px;
    max-height: 300px;
    overflow-y: auto;
}

.file-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    padding: 12px 5px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: white;
    background: #252525;
    cursor: pointer;
    overflow-wrap: anywhere;
    text-align: center;
    font-size: 12px;
}

.file-entry:hover {
    background: #402326;
    border-color: #a51c24;
}

.file-entry .file-icon {
    font-size: 28px;
}

.files-status {
    margin-top: 12px;
    color: #aaa;
    font-size: 12px;
}

@media (max-width: 480px) {
    #paintWindow,
    #filesWindow {
        max-width: calc(100vw - 12px);
    }

    .files-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Stopwatch Window */
#stopwatchWindow {
    position: absolute;
    top: 20%;
    left: 30%;
    width: 350px;
    background: #1c1c1c;
    color: white;
    border: 1px solid #b71c1c;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    font-family: Arial, sans-serif;
    z-index: 100;
}

/* Window Header */
#stopwatchWindow .window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #b71c1c;
    color: white;
    padding: 10px 12px;
    cursor: move;
    font-weight: bold;
}

/* Window Controls */
#stopwatchWindow .window-controls {
    display: flex;
    gap: 5px;
}

#stopwatchWindow .window-controls button {
    width: 28px;
    height: 25px;
    border: none;
    border-radius: 4px;
    background: #333;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

#stopwatchWindow .window-controls button:hover {
    background: #555;
}

/* Stopwatch Display */
#stopwatch-display {
    text-align: center;
    font-size: 38px;
    letter-spacing: 3px;
    margin: 30px 10px;
    color: #ffccbc;
    font-family: monospace;
}

/* Stopwatch Buttons */
#stopwatchWindow > button {
    padding: 10px 16px;
    margin: 0 3px 20px;
    border: none;
    border-radius: 5px;
    background: #b71c1c;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

/* Center the buttons */
#stopwatchWindow {
    text-align: center;
}

#stopwatchWindow > button:hover {
    background: #e53935;
}

#stopwatchWindow > button:active {
    transform: scale(0.96);
}

#todoForm {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

#todoInput {
    flex: 1;
    min-width: 0;
    padding: 10px;
}

#todoList {
    list-style: none;
    display: grid;
    gap: 8px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #292929;
    border-radius: 5px;
    overflow-wrap: anywhere;
}

.todo-item span {
    flex: 1;
}

.todo-item.completed span {
    text-decoration: line-through;
    opacity: 0.6;
}

.delete-todo {
    padding: 5px 8px;
    background: #8b0000;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.empty-todos {
    color: #aaa;
    padding: 10px;
}


.music-player {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

#musicToggle {
    background: #8b0000;
    color: white;
    border: 2px solid #d4af37;
    border-radius: 8px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    transition: background 0.2s, transform 0.2s;
}

#musicToggle:hover {
    background: #b22222;
    transform: scale(1.05);
}

#musicToggle:focus-visible {
    outline: 3px solid #d4af37;
    outline-offset: 3px;
}
