/* --- Base Styles --- */
body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    font-family: "Segoe UI", Arial, sans-serif;
    background: url("static/pomoswallpaper.jpg") center center / cover no-repeat fixed;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

.cursive {
    font-family: 'Caveat', cursive;
}

/* --- Cookie Modal --- */
#cookieModal {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(25px);
    z-index: 9999;
    transition: opacity 0.3s ease;
}

#cookieModal.fade-out {
    opacity: 0;
    pointer-events: none;
}

.cookieCard {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    padding: 25px;
    border-radius: 18px;
    color: white;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#cookieBtn {
    margin-top: 15px;
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    background: #6F4E37;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

#cookieBtn:hover {
    background: #5A3E2A;
}

/* --- Welcome Screen --- */
#welcome {
    position: fixed;
    inset: 0;
    display: flex;
    z-index: 1000;
    backdrop-filter: blur(15px);
    background: rgba(20, 15, 10, 0.4);
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.3, 1), opacity 0.5s ease;
}

#welcome.slide-out {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

.solid-white-slant {
    width: 60%;
    height: 100%;
    background: white;
    clip-path: polygon(0 0, 100% 0, 85% 100%, 0% 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 10%;
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
}

.title {
    font-size: 4rem;
    color: #333;
    margin: 0 0 10px 0;
}

.subtitle {
    color: #555;
    font-size: 1.2rem;
    max-width: 400px;
}

.pink-text {
    color: #d16b8b;
    font-size: 1.8rem;
    margin: 5px 0 30px 0;
}

.coffee-btn {
    width: fit-content;
    padding: 12px 28px;
    border-radius: 20px;
    border: none;
    background: #6F4E37;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(111, 78, 55, 0.4);
    transition: transform 0.2s, background 0.2s;
}

.coffee-btn:hover {
    background: #5A3E2A;
    transform: translateY(-2px);
}

/* --- Desktop & Taskbar --- */
#desktop {
    position: fixed;
    inset: 0;
}

#taskbar {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 25px;
    background: rgba(30, 25, 20, 0.65);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 9000;
}

.logo {
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    padding-right: 15px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.apps {
    display: flex;
    gap: 10px;
    align-items: center;
}

.app-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.2s;
}

.app-icon:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
}

.divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 5px;
}

.quit-btn {
    background: rgba(200, 50, 50, 0.2);
}

.quit-btn:hover {
    background: rgba(200, 50, 50, 0.5);
}

/* --- Windows --- */
.window {
    position: absolute;
    width: 450px;
    background: rgba(245, 245, 245, 0.95);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: popIn 0.2s ease-out forwards;
    transition: opacity 0.2s, transform 0.2s;
}

.window.closing {
    opacity: 0;
    transform: scale(0.9);
}

@keyframes popIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.window-header {
    background: rgba(0, 0, 0, 0.05);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: #333;
    cursor: grab;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.window-header:active {
    cursor: grabbing;
}

.close-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1.2rem;
}

.close-btn:hover {
    color: #d16b8b;
}

.window-content {
    height: 250px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* File Explorer */
.file-grid {
    padding: 15px;
    gap: 8px;
}

.file-item {
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    cursor: pointer;
    color: #333;
    transition: 0.1s;
}

.file-item:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateX(5px);
}

/* Image Viewer */
.img-content {
    padding: 0;
    justify-content: center;
    align-items: center;
    background: #111;
    height: auto;
    min-height: 250px;
}

.img-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* Notes App */
.window-content.notes-layout {
    flex-direction: row;
    height: 100%;
    padding: 0;
}

.notes-sidebar {
    width: 35%;
    background: rgba(0, 0, 0, 0.05);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow-y: auto;
}

.notes-editor {
    width: 65%;
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: #fafafa;
}

.new-note-btn,
.save-note-btn {
    background: #6F4E37;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 10px;
}

.new-note-btn:hover,
.save-note-btn:hover {
    background: #5A3E2A;
}

.note-list-item {
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-list-item:hover {
    background: rgba(0, 0, 0, 0.1);
}

#noteTitle {
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    background: transparent;
    outline: none;
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

#noteBody {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #222;
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    outline: none;
}

/* Terminal App */
.terminal-mode {
    background: #2a1e17;
    /* Dark Espresso */
    color: #b5e8b5;
    /* Soft Matcha Green */
    font-family: 'Consolas', monospace;
    padding: 15px;
    font-size: 0.95rem;
    cursor: text;
}

#termOutput div {
    margin-bottom: 5px;
    word-wrap: break-word;
}

.term-input-line {
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

#termInput {
    background: transparent;
    border: none;
    color: #b5e8b5;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    flex-grow: 1;
}

/* Mini Music Player */
#miniPlayer {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 280px;
    background: rgba(30, 25, 20, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 15px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 8000;
    animation: popIn 0.3s ease-out forwards;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.track-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#playerTitle {
    font-weight: bold;
    font-size: 1rem;
}

#playerArtist {
    font-size: 0.8rem;
    color: #aaa;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.player-controls button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s;
}

.player-controls button:hover {
    color: #d16b8b;
}

#volumeSlider {
    width: 80px;
    cursor: pointer;
    accent-color: #d16b8b;
}

/* Visualizer Animation */
.visualizer {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 20px;
}

.bar {
    width: 4px;
    background: #d16b8b;
    border-radius: 2px;
    height: 5px;
    transition: height 0.1s;
}

.playing .bar:nth-child(1) {
    animation: bounce 1s infinite alternate;
}

.playing .bar:nth-child(2) {
    animation: bounce 1.2s infinite alternate-reverse;
}

.playing .bar:nth-child(3) {
    animation: bounce 0.8s infinite alternate;
}

@keyframes bounce {
    from {
        height: 5px;
    }

    to {
        height: 20px;
    }
}

/* --- Windows --- */
.window {
    position: absolute;
    width: 580px; /* Expanded from 450px so your terminal art fits perfectly */
    background: rgba(245, 245, 245, 0.95);
    backdrop-filter: blur(25px); border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px; box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    display: flex; flex-direction: column; overflow: hidden;
    /* Mac-style bouncy pop-in */
    animation: macPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.window.closing {
    /* Smooth shrink pop-out */
    animation: macPopOut 0.2s cubic-bezier(0.4, 0.0, 1, 1) forwards;
}

@keyframes macPopIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes macPopOut {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(0.85); opacity: 0; }
}

.window-header {
    background: rgba(0, 0, 0, 0.05); padding: 10px 15px; display: flex;
    justify-content: space-between; align-items: center; font-weight: bold; color: #333;
    cursor: grab; border-bottom: 1px solid rgba(0,0,0,0.1);
}
.window-header:active { cursor: grabbing; }
.close-btn { background: transparent; border: none; color: #888; cursor: pointer; font-size: 1.2rem; }
.close-btn:hover { color: #d16b8b; }
.window-content { height: 250px; display: flex; flex-direction: column; overflow-y: auto; }

/* ... (Keep your File Explorer, Image Viewer, and Notes App CSS exactly the same as before) ... */

/* Update this specific terminal rule so the ASCII spaces are respected */
#termOutput div {
    margin-bottom: 5px;
    word-wrap: break-word;
    white-space: pre-wrap; /* Forces the browser to respect your ASCII spacing */
}
/* --- Input Zoom Fix & Global Resets --- */
/* Forces mobile browsers to use a 16px base size, which naturally stops the auto-zoom */
input, textarea { font-size: 16px !important; }

/* --- Windows Update --- */
.window {
    position: absolute;
    /* Use max-width instead of clamp to allow resizing */
    width: 580px;
    max-width: 90vw;
    background: rgba(245, 245, 245, 0.95);
    backdrop-filter: blur(25px); border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px; box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;

    /* Make the window resizable */
    resize: both;
    overflow: hidden; /* Required for resize to work */
    min-height: 250px;
    min-width: 300px;

    animation: macPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Ensure the content stretches when you resize the window */
.window-content { flex-grow: 1; height: 100%; display: flex; flex-direction: column; overflow-y: auto; }

/* --- Pong App --- */
.pong-window {
    width: auto !important; /* Override flexible width */
    max-width: none !important;
    resize: none !important; /* Not resizable */
    min-width: 500px;
}
.pong-content {
    padding: 0;
    justify-content: center;
    align-items: center;
    background: #000;
    overflow: hidden;
    height: 350px;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
}
#pongCanvas {
    background: #000;
    display: block;
}

/* --- Settings App Layout --- */
.settings-layout { padding: 20px; background: #fafafa; color: #333; }
.settings-layout h3 { margin: 0 0 5px 0; font-size: 1.1rem; }
.settings-layout p { margin: 0; font-size: 0.9rem; color: #666; line-height: 1.4; }
.settings-divider { height: 1px; background: #ccc; margin: 15px 0; }
#sysVolumeSlider { width: 100%; cursor: pointer; accent-color: #6F4E37; }

/* --- Taskbar Mobile Scrolling Fix --- */
#taskbar {
    /* ... keep your existing positioning ... */
    max-width: 95vw; /* Don't let it touch screen edges on phones */
    overflow-x: auto; /* Allow horizontal scrolling if apps overflow */
    -webkit-overflow-scrolling: touch;
}

/* --- App Search Bar --- */
.app-search-container {
    padding: 10px 15px 0 15px;
}
.app-search-container input {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.5);
    outline: none;
    box-sizing: border-box;
}

/* --- Pong Overlays --- */
.pong-content {
    position: relative;
}
.pong-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 10;
}
.pong-overlay h2 {
    font-size: 3rem;
    margin: 0 0 10px 0;
    color: #d16b8b;
}
.pong-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #6F4E37;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 8px;
}
.pong-btn:hover {
    background: #5A3E2A;
}

/* --- Calculator App --- */
.calc-window {
    width: 300px !important;
    min-width: 300px;
}
.calc-content {
    padding: 15px;
    background: #222;
}
#calcDisplay {
    width: 100%;
    padding: 15px;
    font-size: 2rem;
    text-align: right;
    border: none;
    background: #111;
    color: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
    box-sizing: border-box;
}
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    flex-grow: 1;
}
.calc-grid button {
    background: #444;
    border: none;
    color: white;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.1s;
}
.calc-grid button:hover {
    background: #555;
}
.calc-grid .calc-op {
    background: #d16b8b;
}
.calc-grid .calc-op:hover {
    background: #b85c79;
}
.calc-grid .calc-clear {
    background: #c83232;
}
.calc-grid .calc-eval {
    background: #6F4E37;
}

/* --- Drawing App --- */
.draw-layout {
    flex-direction: row;
    padding: 0;
    background: #fafafa;
}
.draw-sidebar {
    width: 150px;
    background: rgba(0, 0, 0, 0.05);
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    padding: 10px;
    overflow-y: auto;
}
.draw-title-input {
    width: 100%;
    margin-bottom: 10px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.draw-btn {
    background: #6F4E37;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 10px;
}
.draw-btn:hover {
    background: #5A3E2A;
}
.draw-tools {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #333;
}
.draw-tools input[type="color"] {
    width: 100%;
    cursor: pointer;
}
.draw-tool-btn {
    margin-top: 5px;
    background: #555;
    color: white;
    border: none;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
}
.draw-tool-btn.active {
    background: #d16b8b;
}
.draw-btn:hover {
    background: #5A3E2A;
}
.draw-tools {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: #333;
}
.draw-tools input[type="color"] {
    width: 100%;
    cursor: pointer;
}
.draw-canvas-container {
    flex-grow: 1;
    overflow: auto;
    position: relative;
    cursor: crosshair;
}
#drawCanvas {
    background: white;
    display: block;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.draw-item {
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.draw-item:hover {
    background: rgba(0, 0, 0, 0.1);
}