/* Mac System 6 Simulator - Authentic 1-bit Monochrome Styling */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Chicago', 'Geneva', 'Courier New', monospace;
    background: #000;
    overflow: hidden;
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
}

#mac-screen {
    width: 100vw;
    height: 100vh;
    background: white;
    position: relative;
    overflow: hidden;
}

/* Menu Bar */
#menu-bar {
    height: 20px;
    background: white;
    border-bottom: 2px solid black;
    display: flex;
    align-items: center;
    padding: 0 4px;
    font-size: 12px;
    position: relative;
    z-index: 1000;
}

.menu-item {
    padding: 2px 8px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.menu-item:hover,
.menu-item.active {
    background: black;
    color: white;
}

.apple-logo {
    font-size: 14px;
}

.menu-bar-right {
    margin-left: auto;
    padding: 2px 8px;
}

/* Dropdown Menus */
#dropdown-menus {
    position: absolute;
    top: 20px;
    left: 0;
    z-index: 999;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background: white;
    border: 2px solid black;
    min-width: 150px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
}

.dropdown-menu.active {
    display: block;
}

.menu-option {
    padding: 4px 16px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
}

.menu-option:hover {
    background: black;
    color: white;
}

.menu-divider {
    height: 1px;
    background: black;
    margin: 2px 8px;
}

/* Desktop */
#desktop {
    width: 100%;
    height: calc(100% - 20px);
    background: white;
    position: relative;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0,0,0,0.03) 1px, rgba(0,0,0,0.03) 2px);
}

/* Desktop Icons */
.desktop-icon {
    position: absolute;
    width: 64px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    padding: 4px;
}

.desktop-icon:nth-child(1) { top: 10px; right: 10px; }
.desktop-icon:nth-child(2) { top: 90px; right: 10px; }
.desktop-icon:nth-child(3) { top: 170px; right: 10px; }
.desktop-icon:nth-child(4) { top: 250px; right: 10px; }
.desktop-icon:nth-child(5) { top: 330px; right: 10px; }
.desktop-icon:nth-child(6) { top: 410px; right: 10px; }
.desktop-icon:nth-child(7) { top: 490px; right: 10px; }
.desktop-icon:nth-child(8) { top: 570px; right: 10px; }
.desktop-icon:nth-child(9) { top: 10px; right: 90px; }
.desktop-icon:nth-child(10) { top: 90px; right: 90px; }
.desktop-icon:nth-child(11) { top: 170px; right: 90px; }
.desktop-icon:nth-child(12) { top: 250px; right: 90px; }

.desktop-icon.selected {
    background: black;
    color: white;
}

.icon-image {
    width: 48px;
    height: 48px;
    margin: 0 auto 4px;
    border: 2px solid black;
    background: white;
    position: relative;
}

.disk-icon::before {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid black;
    border-radius: 4px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.disk-icon::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 3px;
    background: black;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.trash-icon::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 28px;
    border: 2px solid black;
    border-radius: 0 0 4px 4px;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.trash-icon::after {
    content: '';
    position: absolute;
    width: 28px;
    height: 4px;
    background: black;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
}

.app-icon::before {
    content: '';
    position: absolute;
    width: 32px;
    height: 32px;
    border: 2px solid black;
    border-radius: 4px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.icon-label {
    font-size: 10px;
    word-wrap: break-word;
    line-height: 12px;
}

/* Windows */
.window {
    position: absolute;
    background: white;
    border: 2px solid black;
    min-width: 200px;
    min-height: 100px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.window.active {
    z-index: 100;
}

.window-title-bar {
    height: 20px;
    background: white;
    border-bottom: 2px solid black;
    display: flex;
    align-items: center;
    cursor: move;
    user-select: none;
}

.window-close {
    width: 16px;
    height: 16px;
    border: 2px solid black;
    margin: 0 4px;
    cursor: pointer;
    position: relative;
}

.window-close::before,
.window-close::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 2px;
    background: black;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
}

.window-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.window-title {
    flex: 1;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
}

.window-resize {
    width: 16px;
    height: 16px;
    margin: 0 4px;
}

.window-content {
    flex: 1;
    overflow: auto;
    padding: 8px;
    background: white;
}

/* Finder Window */
.finder-items {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 8px;
}

.finder-item {
    width: 64px;
    text-align: center;
    cursor: pointer;
    user-select: none;
    padding: 4px;
}

.finder-item:hover,
.finder-item.selected {
    background: black;
    color: white;
}

.finder-item-icon {
    width: 32px;
    height: 32px;
    border: 2px solid black;
    margin: 0 auto 4px;
    background: white;
}

.finder-item-label {
    font-size: 10px;
    word-wrap: break-word;
}

/* Calculator */
.calculator {
    width: 200px;
    padding: 8px;
}

.calc-display {
    width: 100%;
    height: 32px;
    border: 2px solid black;
    background: white;
    text-align: right;
    padding: 4px 8px;
    font-size: 16px;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.calc-button {
    height: 32px;
    border: 2px solid black;
    background: white;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calc-button:active {
    background: black;
    color: white;
}

.calc-button.wide {
    grid-column: span 2;
}

/* Notepad */
.notepad-content {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    resize: none;
    background: white;
    color: black;
}

/* Browser */
.browser-toolbar {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-bottom: 2px solid black;
}

.browser-button {
    padding: 4px 8px;
    border: 2px solid black;
    background: white;
    cursor: pointer;
    font-size: 10px;
    user-select: none;
}

.browser-button:active {
    background: black;
    color: white;
}

.browser-url {
    flex: 1;
    padding: 4px 8px;
    border: 2px solid black;
    font-size: 10px;
    font-family: 'Courier New', monospace;
}

.browser-content {
    padding: 16px;
    overflow: auto;
    height: calc(100% - 40px);
}

.browser-content h1 {
    font-size: 18px;
    margin-bottom: 8px;
    border-bottom: 2px solid black;
    padding-bottom: 4px;
}

.browser-content p {
    font-size: 12px;
    line-height: 16px;
    margin-bottom: 8px;
}

.browser-content a {
    color: black;
    text-decoration: underline;
    cursor: pointer;
}

/* Paint */
.paint-toolbar {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-bottom: 2px solid black;
}

.paint-tool {
    width: 32px;
    height: 32px;
    border: 2px solid black;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    user-select: none;
}

.paint-tool.active {
    background: black;
    color: white;
}

.paint-canvas {
    border: none;
    cursor: crosshair;
    background: white;
    display: block;
}

/* Clock */
.clock-display {
    text-align: center;
    padding: 32px;
}

.clock-time {
    font-size: 48px;
    font-family: 'Courier New', monospace;
    margin-bottom: 16px;
}

.clock-date {
    font-size: 16px;
    margin-bottom: 8px;
}

.clock-day {
    font-size: 14px;
}

/* About Dialog */
.about-content {
    text-align: center;
    padding: 16px;
}

.about-logo {
    width: 64px;
    height: 64px;
    border: 2px solid black;
    margin: 0 auto 16px;
    position: relative;
}

.about-logo::before {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid black;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.about-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.about-version {
    font-size: 12px;
    margin-bottom: 16px;
}

.about-info {
    font-size: 10px;
    line-height: 14px;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: white;
    border: 2px solid black;
}

::-webkit-scrollbar-thumb {
    background: white;
    border: 2px solid black;
}

::-webkit-scrollbar-thumb:hover {
    background: black;
}

/* Selection */
::selection {
    background: black;
    color: white;
}

/* Resize Handle */
.window-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

.window-resize-handle::before,
.window-resize-handle::after {
    content: '';
    position: absolute;
    background: black;
}

.window-resize-handle::before {
    width: 2px;
    height: 12px;
    right: 2px;
    bottom: 2px;
}

.window-resize-handle::after {
    width: 12px;
    height: 2px;
    right: 2px;
    bottom: 2px;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-mac {
    width: 128px;
    height: 128px;
    border: 4px solid black;
    border-radius: 8px;
    margin-bottom: 32px;
    position: relative;
}

.loading-mac::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 60px;
    border: 3px solid black;
    border-radius: 4px;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.loading-mac::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 4px;
    background: black;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.loading-text {
    font-size: 16px;
    margin-bottom: 16px;
}

.loading-bar {
    width: 200px;
    height: 20px;
    border: 2px solid black;
    position: relative;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: black;
    width: 0%;
    transition: width 0.3s;
}

/* Dialog Box */
.dialog-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid black;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    z-index: 9999;
    min-width: 300px;
}

.dialog-content {
    padding: 16px;
    text-align: center;
    font-size: 12px;
}

.dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border-top: 2px solid black;
}

.dialog-button {
    padding: 6px 16px;
    border: 2px solid black;
    background: white;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
}

.dialog-button:active {
    background: black;
    color: white;
}

/* Browser iframe for real websites */
.browser-frame {
    width: 100%;
    height: 100%;
    border: none;
    filter: grayscale(100%) contrast(300%) brightness(1.5) invert(0);
    image-rendering: pixelated;
    background: white;
}

/* Alternative high contrast filter */
.browser-frame.high-contrast {
    filter: grayscale(100%) contrast(500%) brightness(2) saturate(0);
}

/* Puzzle Game */
.puzzle-container {
    padding: 16px;
    text-align: center;
}

.puzzle-grid {
    display: inline-grid;
    grid-template-columns: repeat(4, 60px);
    grid-template-rows: repeat(4, 60px);
    gap: 2px;
    background: black;
    border: 2px solid black;
    padding: 2px;
}

.puzzle-tile {
    background: white;
    border: 1px solid black;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
}

.puzzle-tile:hover {
    background: #f0f0f0;
}

.puzzle-tile.empty {
    background: black;
    cursor: default;
}

.puzzle-controls {
    margin-top: 16px;
}

.puzzle-button {
    padding: 8px 16px;
    border: 2px solid black;
    background: white;
    cursor: pointer;
    font-size: 12px;
    margin: 0 4px;
}

.puzzle-button:active {
    background: black;
    color: white;
}

/* Scrapbook */
.scrapbook-container {
    padding: 16px;
}

.scrapbook-page {
    min-height: 300px;
    border: 2px solid black;
    padding: 16px;
    background: white;
    margin-bottom: 16px;
}

.scrapbook-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.scrapbook-button {
    padding: 6px 12px;
    border: 2px solid black;
    background: white;
    cursor: pointer;
    font-size: 11px;
}

.scrapbook-button:active {
    background: black;
    color: white;
}

/* Key Caps */
.keycaps-container {
    padding: 16px;
}

.keycaps-display {
    width: 100%;
    height: 60px;
    border: 2px solid black;
    background: white;
    padding: 8px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    margin-bottom: 16px;
    text-align: center;
    line-height: 44px;
}

.keycaps-keyboard {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.keycaps-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.keycaps-key {
    min-width: 32px;
    height: 32px;
    border: 2px solid black;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
    padding: 0 4px;
}

.keycaps-key:active {
    background: black;
    color: white;
}

.keycaps-key.wide {
    min-width: 64px;
}

.keycaps-key.wider {
    min-width: 96px;
}

/* Chooser */
.chooser-container {
    padding: 16px;
}

.chooser-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.chooser-panel {
    border: 2px solid black;
    padding: 8px;
    min-height: 200px;
}

.chooser-title {
    font-weight: bold;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid black;
}

.chooser-item {
    padding: 4px 8px;
    cursor: pointer;
    user-select: none;
}

.chooser-item:hover,
.chooser-item.selected {
    background: black;
    color: white;
}
