/* ========================================================================== */


/*                              CSS Variables                                 */


/* ========================================================================== */

:root {
    /* Color Palette */
    --primary-color: #245DDA;
    --secondary-color: #2b4f7b;
    --light-bg: #ffffff;
    --dark-bg: #000;
    --text-color: #000;
    --white: #fff;
    --grey-light: #e0e0e0;
    --grey-medium: #d0d0d0;
    --grey-dark: #808080;
    --xp-blue: #3e7bb6;
    /* Fonts */
    --font-primary: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-secondary: 'Tahoma', sans-serif;
    /* Icon sizes */
    --icon-size: 28px;
    /* Shadows & Borders */
    --shadow-light: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-strong: 5px 5px 15px rgba(0, 0, 0, 0.5);
    --border-secondary: 2px solid var(--secondary-color);
    /* Transitions */
    --transition-fast: 0.2s ease-in-out;
    --transition-slow: 0.3s ease;
}


/* ========================================================================== */


/*                          Global & Base Styles                              */


/* ========================================================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    background: url('win98-bg.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--text-color);
}


/* ========================================================================== */


/*                         Desktop & Icon Styles                              */


/* ========================================================================== */


/* Desktop Container */

#desktop {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    position: relative;
}


/* Common Desktop Icon */

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    width: 80px;
    text-align: center;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.desktop-icon img {
    width: 64px;
    height: 64px;
    margin-bottom: 5px;
}

.desktop-icon p {
    font-size: 14px;
    margin: 0;
}

.desktop-icon:hover {
    transform: scale(1.1);
}


/* Specific Icon Adjustments */

.desktop-icon[data-id="recycle-bin"] {
    position: fixed;
    bottom: 75px;
    right: 20px;
}

.desktop-icon[data-id="recycle-bin"] img {
    width: 40px;
    height: 40px;
}

.desktop-icon[data-id="recycle-bin"].empty img {
    content: url('recycle-bin-empty-icon.png');
}

.desktop-icon[data-id="tired"] img {
    width: 40px;
    height: 40px;
}


/* ========================================================================== */


/*                          Taskbar & Start Menu Styles                       */


/* ========================================================================== */


/* Taskbar */

#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-color));
    border-top: 2px solid var(--secondary-color);
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.5);
    z-index: 100;
}


/* Start Button */

#start-button {
    width: 140px;
    height: 85px;
    background: url('start-xp-icon.png') no-repeat center center;
    background-size: contain;
    border: none;
    cursor: pointer;
    padding: 2px;
    margin-left: -7px;
    margin-bottom: -10px;
    transition: transform var(--transition-fast);
}

#start-button:hover {
    transform: scale(1.12);
}

#start-button:active {
    transform: scale(0.95);
}

#start-button::after {
    content: "Start";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-family: var(--font-secondary);
    color: var(--white);
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 5px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

#start-button:hover::after {
    opacity: 1;
}


/* Taskbar Clock */

#taskbar-clock {
    margin-left: auto;
    color: var(--white);
    font-family: var(--font-secondary);
    font-size: 14px;
    text-shadow: 1px 1px 0 var(--secondary-color);
    padding-right: 27px;
}


/* Start Menu */

#start-menu {
    position: fixed;
    bottom: 60px;
    left: 10px;
    width: 200px;
    background: linear-gradient(to bottom, #dbe9f4, #b8d0ec);
    border: 2px solid var(--xp-blue);
    border-radius: 10px;
    /* Rounded corners */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    padding: 10px;
    z-index: 200;
    transition: transform 0.2s ease-in-out;
}

#start-menu ul {
    list-style: none;
    margin: 0;
    padding: 1px;
}

#start-menu li {
    margin: 2px 0;
    display: flex;
    align-items: center;
    /*padding: 5px 10px; */
}

#start-menu li button {
    /*width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
    color: var(--text-color);
    font-family: var(--font-secondary);
    transition: background var(--transition-fast);
    */
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 6px;
    font-size: 14px;
    color: #000;
    /* Tahoma is close to the XP default font */
    font-family: Tahoma, sans-serif;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    /* space between icon and text */
}

#start-menu li button:hover {
    transform: scale(1.02);
    background: rgba(0, 0, 0, 0.1);
}

.start-menu-icon {
    width: var(--icon-size);
    height: var(--icon-size);
    /* Optionally add object-fit if using images with intrinsic dimensions */
    object-fit: contain;
}


/* Responsive example: increase icon size on larger screens */

@media (min-width: 768px) {
     :root {
        --icon-size: 35px;
    }
}


/* ========================================================================== */


/*                          Window & Modal Styles                             */


/* ========================================================================== */


/* Main window content area */

#main-window-content {
    padding: 10px 15px;
}


/* Games window content area (if you want a bit of padding there too) */

#games-window-content {
    padding: 10px 15px;
}


/* Generic content utilities to replace inline styles */

.window-title {
    margin-left: 10px;
    margin-top: 5px;
}

.window-text {
    margin-left: 10px;
    text-align: left;
}

.window-list {
    margin-left: 30px;
    text-align: left;
}


/* Main Content Window */

#main-content {
    position: absolute;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 60%;
    background: rgba(255, 255, 255, 0.95);
    border: var(--border-secondary);
    box-shadow: var(--shadow-strong);
    padding: 1px;
    overflow-y: auto;
    z-index: 10;
}


/* Utility: Hide elements */

.hidden {
    display: none !important;
}


/* Window Controls (Toolbar) */

.window-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-color));
    color: var(--white);
    width: calc(100% - 0.5px);
    padding: 0.5px;
    border-bottom: 1px solid var(--secondary-color);
    cursor: grab;
}

.window-controls button {
    width: 25px;
    height: 25px;
    font-family: var(--font-secondary);
    font-size: 14px;
    background: var(--grey-light);
    border: 1px solid var(--grey-dark);
    cursor: pointer;
    margin: 0 2px;
    transition: background var(--transition-fast), transform 0.1s ease-in-out;
}

.window-controls button:hover {
    background: var(--grey-medium);
}

.window-controls button:active {
    transform: translateY(1px);
    background: #c0c0c0;
}


/* Minimized Windows */

#minimized-windows {
    display: flex;
    gap: 5px;
    max-width: 50%;
    overflow-x: auto;
    padding: 0 10px;
}

.taskbar-item {
    background: #bfcde0;
    border: 1px solid var(--grey-dark);
    padding: 5px 10px;
    font-family: var(--font-secondary);
    font-size: 14px;
    cursor: pointer;
    border-radius: 3px;
}

.taskbar-item:hover {
    background: var(--grey-medium);
}


/* Popup Games Window */

#popup-games {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.9);
    border: var(--border-secondary);
    box-shadow: var(--shadow-strong);
    z-index: 5;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    #popup-games {
        width: 90%;
        height: 70%;
    }
}

@media (max-width: 480px) {
    #popup-games {
        width: 95%;
        height: 80%;
    }
}


/* Games Folder & Icons */

#games-folder {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.game-icon {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    width: 80px;
    text-align: center;
    cursor: pointer;
}

.game-icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 5px;
    transition: transform var(--transition-fast);
}

.game-icon img:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

.game-icon p {
    font-size: 12px;
    color: var(--text-color);
}


/* Hidden Popup GIF for Game Icons */

.popup-gif {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 150px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: var(--shadow-light);
    z-index: 10;
    opacity: 0;
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.popup-gif img {
    width: 100%;
    height: auto;
}

.game-icon:hover .popup-gif {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    display: block;
}


/* ========================================================================== */


/*                        Content Specific Styles                             */


/* ========================================================================== */


/* About Me Images */

#about-images {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding: 0 10px;
}

.about-image {
    width: calc(33.33% - 20px);
    max-width: 200px;
    height: auto;
    border: 2px solid var(--secondary-color);
    box-shadow: var(--shadow-light);
    border-radius: 5px;
    transition: transform var(--transition-slow);
}

.about-image:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}


/* Responsive About Me Images */

@media (max-width: 768px) {
    .about-image {
        width: calc(50% - 15px);
    }
}

@media (max-width: 480px) {
    .about-image {
        width: 100%;
        max-width: 300px;
    }
}


/* ========================================================================== */


/*                      Project Gallery & Folder Styles                       */


/* ========================================================================== */

#gallery-folder {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    padding: 0 10px;
}

.project-folder {
    width: calc(33.33% - 20px);
    max-width: 200px;
    border: 2px solid var(--secondary-color);
    box-shadow: var(--shadow-light);
    border-radius: 5px;
    transition: transform var(--transition-slow);
    text-align: center;
    cursor: pointer;
    overflow: hidden;
}

.project-folder:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.project-folder img {
    width: 100%;
    aspect-ratio: 4 / 3;
    /* pick a ratio you like: 4/3, 16/9, 1/1 */
    height: auto;
    border-radius: 5px;
    object-fit: cover;
    /* crop to fill the frame, no distortion */
    display: block;
}

.project-folder p {
    margin-top: 10px;
    font-size: 14px;
    font-family: var(--font-primary);
}


/* ========================================================================== */


/*                    Project Details Window Styles                           */


/* ========================================================================== */

#project-details {
    position: absolute;
    width: 70%;
    height: 60%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border: var(--border-secondary);
    box-shadow: var(--shadow-strong);
    overflow-y: auto;
    z-index: 15;
    display: flex;
    flex-direction: column;
}


/* Project Title Bar */

#project-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-color));
    color: var(--white);
    padding: 5px 10px;
    border-bottom: 2px solid var(--secondary-color);
    font-family: var(--font-secondary);
    font-size: 14px;
    cursor: grab;
    position: relative;
}


/* Project Control Buttons */

#project-controls button {
    width: 25px;
    height: 25px;
    font-family: var(--font-secondary);
    font-size: 14px;
    background: var(--grey-light);
    border: 1px solid var(--grey-dark);
    cursor: pointer;
    margin-left: 5px;
    transition: background var(--transition-fast), transform 0.1s ease-in-out;
}

#project-controls button:hover {
    background: var(--grey-medium);
}

#project-controls button:active {
    transform: translateY(1px);
    background: #c0c0c0;
}

#project-controls div:last-child {
    display: flex;
    gap: 5px;
    position: absolute;
    top: 2px;
    right: 10px;
}

#project-content {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
    align-items: flex-start;
    justify-content: flex-start;
}

#project-content img {
    width: calc(33.33% - 20px);
    max-width: 200px;
    height: auto;
    border: 2px solid var(--secondary-color);
    box-shadow: var(--shadow-light);
    border-radius: 5px;
    transition: transform var(--transition-slow);
    margin: 15px;
}

#project-content img:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

#project-content p {
    font-size: 14px;
    line-height: 1.6;
    margin-top: 10px;
    font-family: var(--font-primary);
    text-align: center;
    max-width: 600px;
}


/* ========================================================================== */


/*                         Hangman Game Styles                                */


/* ========================================================================== */

#hangman {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 400px;
    background: var(--light-bg);
    border: var(--border-secondary);
    box-shadow: var(--shadow-strong);
    display: flex;
    flex-direction: column;
    padding: 1px;
    z-index: 15;
    overflow: hidden;
}


/* Center the canvas and give it a border similar to other game elements */

#hangman-canvas {
    width: 40%;
    /* 80% of container's width */
    max-height: 40%;
    /* Up to 40% of container's height */
    background-color: #f4f4f4;
    border: 1px solid #ccc;
    display: block;
    margin: 4rem;
    /* The canvas's internal drawing dimensions can be adjusted via JS if needed */
}


/* Container for Hangman game content */

#hangman-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}


/* Hangman board for displaying the word and used letters */

#hangman-board {
    width: 50%;
    text-align: center;
    margin-bottom: 1rem;
}


/* Display for the guessed word  */

#word-display {
    font-size: 24px;
    letter-spacing: 4px;
    margin-bottom: 10px;
}


/* Display for used letters and status text */

#used-letters {
    font-size: 14px;
    color: #555;
    margin-bottom: 10px;
}


/* Letter input styling, larger for better usability */

#letter-input {
    width: 60px;
    height: 40px;
    font-size: 24px;
    text-align: center;
    margin-bottom: 10px;
}


/* Hangman status (e.g. "Attempts left: ...") */

#hangman-status {
    font-size: 14px;
    font-weight: bold;
    color: var(--secondary-color);
    margin-top: 10px;
}


/* =============================================================================
     Responsive Adjustments
     ============================================================================= */

@media (max-width: 768px) {
    #hangman {
        width: 90%;
        height: auto;
        max-height: 80vh;
        padding: 0.5rem;
    }
    #word-display {
        font-size: 20px;
    }
    #used-letters,
    #hangman-status {
        font-size: 12px;
    }
    #letter-input {
        width: 50px;
        height: 35px;
        font-size: 20px;
    }
}


/* ========================================================================== */


/*                        Tic Tac Toe Game Styles                             */


/* ========================================================================== */

#tic-tac-toe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 400px;
    background: var(--light-bg);
    border: var(--border-secondary);
    box-shadow: var(--shadow-strong);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centers children horizontally */
    justify-content: center;
    /* Centers children vertically */
    padding: 1px;
}

#board {
    display: grid;
    grid-template-columns: repeat(3, 100px);
    gap: 5px;
    margin: 0 auto;
}

.cell {
    width: 65px;
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    cursor: pointer;
}

.cell.taken {
    cursor: not-allowed;
    background-color: #ddd;
}


/* Style for the game title */

#tic-tac-toe h1 {
    text-align: center;
    margin: 10px 0;
    font-size: 2rem;
    /* Use relative units (rem) to adjust easily */
    font-family: var(--font-secondary);
}


/* Style for the status message ("Your turn!") */

#tic-tac-toe-status {
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
    color: #555;
    font-family: var(--font-secondary);
}


/* ========================================================================== */


/*                        Guessing Game Styles                                */


/* ========================================================================== */

#guessing-game {
    position: absolute;
    width: 600px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #f9f9f9;
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#guessing-game .drag-handle {
    background-color: #ddd;
    padding: 5px;
    cursor: move;
}

#guessing-game-content {
    padding: 10px;
    flex-grow: 1;
}


/* Responsive Guessing Game */

@media (max-width: 768px) {
    #guessing-game {
        width: 90%;
        height: 50%;
        top: 20%;
        left: 50%;
        transform: translate(-50%, 0);
        font-size: 14px;
    }
    #guessing-game .drag-handle {
        font-size: 12px;
        padding: 8px;
    }
    #guessing-game-content {
        padding: 5px;
    }
}

@media (max-width: 480px) {
    #guessing-game {
        width: 95%;
        height: 60%;
        top: 10%;
        left: 50%;
        transform: translate(-50%, 0);
        font-size: 12px;
    }
    #guessing-game .drag-handle {
        font-size: 10px;
        padding: 6px;
    }
    #guessing-game-content {
        padding: 3px;
    }
}


/* ========================================================================== */


/*                     Popup Menu & Miscellaneous Effects                     */


/* ========================================================================== */

.popup-menu {
    position: absolute;
    background-color: var(--white);
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-radius: 5px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
}

.popup-menu.hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.popup-menu:not(.hidden) {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.popup-menu button {
    background-color: var(--white);
    border: none;
    text-align: left;
    padding: 5px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.popup-menu button:hover {
    background-color: #f0f0f0;
}


/* ========================================================================== */


/*                   Prank & AI Assistant Effects                             */


/* ========================================================================== */


/* Prank Cursor & Animation */

.confused {
    cursor: url('spinning-icon.png'), auto;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: red;
    border-radius: 50%;
    animation: explode 1s ease-out forwards;
    opacity: 1;
}

@keyframes explode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(var(--random-x) * 100px), calc(var(--random-y) * 100px)) scale(0.5);
        opacity: 0;
    }
}


/* Prank Icon Specifics */

.desktop-icon[data-id="prank"] img {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.desktop-icon[data-id="prank"]:hover {
    transform: rotate(15deg) scale(1.1);
    transition: transform 0.3s ease;
    opacity: 0.5;
}


/* AI Assistant */

#ai-assistant {
    position: absolute;
    top: 280px;
    left: 50px;
    text-align: center;
    cursor: grab;
    animation: bounce 2s infinite ease-in-out;
    z-index: 5500;
}

#ai-assistant:active {
    cursor: grabbing;
}

#ai-assistant.dragging {
    user-select: none;
    animation: none;
}

#assistant-icon {
    width: 120px;
    height: auto;
}

#assistant-bubble {
    position: absolute;
    bottom: 100px;
    right: 0;
    background-color: var(--white);
    border: 1px solid #ccc;
    border-radius: 10px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    padding: 10px;
    font-size: 14px;
    font-family: var(--font-primary);
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

#assistant-bubble.show {
    opacity: 1;
    transform: translateY(0);
}

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@media (max-width: 768px) {
    #ai-assistant {
        top: 200px;
        left: 20px;
    }
    #assistant-icon {
        width: 80px;
    }
    #assistant-bubble {
        bottom: 80px;
        font-size: 12px;
        width: calc(100% - 40px);
        left: 50%;
        transform: translateX(-50%) translateY(10px);
    }
}

@media (max-width: 480px) {
    #ai-assistant {
        top: 150px;
        left: 10px;
    }
    #assistant-icon {
        width: 60px;
    }
    #assistant-bubble {
        bottom: 70px;
        font-size: 10px;
        width: calc(100% - 20px);
        left: 50%;
        transform: translateX(-50%) translateY(10px);
    }
}


/* =============================================================================
   BSOD Screen Styles (Overlay)
   ============================================================================= */

#bsod-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: url('bsod-screenshot.png') no-repeat center center;
    background-size: contain;
    /* Adjust to cover the entire screen */
    background-color: #000;
    z-index: 9999;
    display: block;
    /* Ensure it displays when not hidden */
}

#bsod-screen.hidden {
    display: none;
}