/* --- Global & Body --- */
body {
    background-color: #008080; /* Classic teal background */
    font-family: "MS Sans Serif", "Arial", sans-serif;
    font-size: 16px;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Reusable Border Classes for Win95 Look --- */
.border-outset {
    border: 2px solid;
    border-color: #dfdfdf #808080 #808080 #dfdfdf;
    box-shadow: inset 1px 1px #ffffff;
}
.border-outset:active {
    border-color: #808080 #dfdfdf #dfdfdf #808080;
}

.border-inset {
    border: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    box-shadow: inset 1px 1px #c0c0c0;
}

/* --- Desktop --- */
#desktop {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 30px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    text-align: center;
    cursor: pointer;
}
.desktop-icon img {
    width: 48px;
    height: 48px;
}
.desktop-icon span {
    color: white;
    margin-top: 8px;
    text-shadow: 1px 1px 2px black;
}
.desktop-icon:focus span, .desktop-icon.selected span {
    background-color: #000080;
    outline: 1px dotted #ffffff;
}


/* --- Taskbar --- */
.taskbar {
    display: flex;
    align-items: center;
    background-color: #c0c0c0;
    padding: 3px;
    height: 34px;
    box-sizing: border-box;
    border-top: 2px solid #ffffff;
}

.start-button {
    display: flex;
    align-items: center;
    padding: 2px 6px;
    font-weight: bold;
    cursor: pointer;
    background-color: #c0c0c0;
}
.start-button img {
    width: 22px;
    height: 22px;
    margin-right: 4px;
}
.start-button.active {
    border-style: inset;
}

.taskbar-windows {
    display: flex;
    flex-grow: 1;
    margin: 0 5px;
    gap: 4px;
    height: 100%;
}

.taskbar-btn {
    flex: 1 1 0;
    max-width: 160px;
    text-align: left;
    padding: 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: #c0c0c0;
    border-style: outset;
    font-size: 14px;
}
.taskbar-btn.active {
    border-style: inset;
    font-weight: bold;
}

.clock {
    padding: 2px 8px;
    margin-right: 2px;
}

/* --- Start Menu --- */
.start-menu {
    position: absolute;
    bottom: 34px;
    left: 0;
    width: 220px;
    background-color: #c0c0c0;
    padding: 2px;
    display: flex;
}
.start-menu-sidebar {
    background: #808080;
    width: 30px;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    padding: 10px 0;
}
.start-menu-sidebar::before {
    content: "Windows 95";
}
.start-menu ul {
    list-style: none;
    margin: 0;
    padding: 5px 0;
    width: 100%;
}
.start-menu li {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
}
.start-menu li:hover {
    background-color: #000080;
    color: white;
}
.start-menu li img {
    width: 32px;
    height: 32px;
    margin-right: 10px;
}

/* --- Window --- */
.window {
    position: absolute;
    top: 50px;
    left: 150px;
    width: 450px;
    min-height: 250px;
    background: #c0c0c0;
    padding: 3px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-width: 260px;
}
.window.minimized {
    display: none;
}
.title-bar {
    background: linear-gradient(to right, #000080, #1084d0);
    color: white;
    padding: 4px 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    cursor: move;
}
.title-bar-text {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.title-bar-controls button {
    width: 20px;
    height: 20px;
    margin-left: 2px;
    background-color: #c0c0c0;
    font-family: "Marlett", "MS Sans Serif"; /* Marlett has the UI symbols */
    font-size: 12px;
    padding: 0;
    line-height: 1;
}
.minimize-btn::before { content: "0"; }
.close-btn::before { content: "r"; }

.window-body {
    background: white;
    margin: 3px;
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
}

/* --- Resize Handles --- */
.resize-handle {
    position: absolute;
    z-index: 3; /* above window content, below title bar interactions */
}

/* corners */
.resize-nw, .resize-ne, .resize-se, .resize-sw {
    width: 12px;
    height: 12px;
}
.resize-nw { top: -2px; left: -2px; cursor: nwse-resize; }
.resize-ne { top: -2px; right: -2px; cursor: nesw-resize; }
.resize-se { bottom: -2px; right: -2px; cursor: nwse-resize; }
.resize-sw { bottom: -2px; left: -2px; cursor: nesw-resize; }

/* edges */
.resize-n, .resize-s { left: 6px; right: 6px; height: 6px; }
.resize-n { top: -2px; cursor: n-resize; }
.resize-s { bottom: -2px; cursor: s-resize; }
.resize-e, .resize-w { top: 6px; bottom: 6px; width: 6px; }
.resize-e { right: -2px; cursor: e-resize; }
.resize-w { left: -2px; cursor: w-resize; }

/* Prevent accidental text selection while resizing */
body.resizing {
    user-select: none;
}

/* --- NEW: AOL Popup Styles --- */
.aol-popup {
    border: 4px solid #000080;
    box-shadow: 5px 5px 10px rgba(0,0,0,0.5);
    width: 400px; /* Different size */
}
.aol-title-bar {
    animation: flash 1s infinite;
}
@keyframes flash {
    0%, 100% { background: linear-gradient(to right, #ff4500, #ff8c00); }
    50% { background: linear-gradient(to right, #1e90ff, #4169e1); }
}

/* --- NEW: Popup2 Styles --- */
.popup2-window {
    border: 4px solid #ff0000;
    box-shadow: 5px 5px 10px rgba(0,0,0,0.5);
    width: 400px;
}
.popup2-window .title-bar {
    animation: flash2 1.5s infinite;
}
@keyframes flash2 {
    0%, 100% { background: linear-gradient(to right, #cd0639, #ff0746); }
    25% { background: linear-gradient(to right, #cd0639, #ff0746); }
    50% { background: linear-gradient(to right, #ffffff, #cccccc); }
    75% { background: linear-gradient(to right, #0a3161, #1157ad); }
}
.aol-popup .window-body {
    background: #f0f0f0;
    text-align: center;
}
.aol-popup .window-body h2 {
    color: #000080;
}
.aol-popup .window-body .promo-button {
    background-color: #ffbf00;
    padding: 10px 20px;
    font-weight: bold;
    border: 2px outset #ffffff;
    cursor: pointer;
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Responsive Design --- */
@media (max-width: 640px) {
    .window {
        width: 95vw;
        height: 75vh;
        top: 2vh;
        left: 2.5vw;
    }
    #desktop {
        padding: 10px;
        gap: 15px;
        flex-direction: row;
    }
    .desktop-icon { width: 70px; }
    .desktop-icon img { width: 40px; height: 40px; }
    .desktop-icon span { font-size: 12px; }
    .taskbar-btn { max-width: 80px; }
    .start-menu { 
        width: 98vw; 
        z-index: 1000; /* Ensure start menu appears above windows */
    }
    /* Fix button sizing on mobile */
    .title-bar-controls button {
        width: 28px;
        height: 28px;
        font-size: 16px;
        margin-left: 4px;
    }
    /* Larger hit areas for resize handles on mobile */
    .resize-nw, .resize-ne, .resize-se, .resize-sw { width: 16px; height: 16px; }
    .resize-n, .resize-s { height: 10px; }
    .resize-e, .resize-w { width: 10px; }
}
