/* System.css inspired styles - inline to avoid CDN issues */

/* Base Reset */
* {
    box-sizing: border-box;
}

/* Desktop Environment */
body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Chicago', 'Geneva', 'Courier New', monospace;
    background: #fff;
}

.desktop {
    width: 100vw;
    height: 100vh;
    background: url('data:image/svg+xml,<svg width="2" height="2" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" fill="%23fff"/><rect x="1" y="1" width="1" height="1" fill="%23fff"/><rect x="1" width="1" height="1" fill="%23ddd"/><rect y="1" width="1" height="1" fill="%23ddd"/></svg>');
    background-size: 2px 2px;
    position: relative;
}

/* Menu Bar */
.menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: #fff;
    border-bottom: 1px solid #000;
    z-index: 9999;
    font-size: 12px;
}

.menu-bar-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 4px;
}

.menu-item {
    padding: 2px 12px;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.menu-item:hover {
    background: #000;
    color: #fff;
}

.menu-clock {
    margin-left: auto;
    padding: 2px 8px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #000;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
    min-width: 180px;
    z-index: 10000;
}

.dropdown-item {
    padding: 4px 20px 4px 8px;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #000;
    color: #fff;
}

.menu-divider {
    height: 1px;
    background: #000;
    margin: 2px 0;
}

/* Windows */
.window {
    position: absolute;
    background: #fff;
    border: 1px solid #000;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.window.active .title-bar {
    background: repeating-linear-gradient(
        90deg,
        #000 0px,
        #000 1px,
        #fff 1px,
        #fff 2px
    );
    color: #fff;
}

.title-bar {
    height: 19px;
    background: #fff;
    border-bottom: 1px solid #000;
    display: flex;
    align-items: center;
    padding: 0 4px;
    cursor: move;
    user-select: none;
}

.title-bar-text {
    flex: 1;
    font-weight: bold;
    font-size: 12px;
    padding-left: 4px;
}

.title-bar-controls {
    display: flex;
    gap: 2px;
}

.window-close-btn {
    width: 13px;
    height: 13px;
    background: #fff;
    border: 1px solid #000;
    cursor: pointer;
    padding: 0;
    position: relative;
}

.window.active .window-close-btn {
    background: #fff;
}

.window-close-btn:hover {
    background: #ddd;
}

.window-close-btn:active {
    background: #000;
}

.window-close-btn::before,
.window-close-btn::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 1px;
    background: #000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.window.active .window-close-btn::before,
.window.active .window-close-btn::after {
    background: #000;
}

.window-body {
    flex: 1;
    overflow: auto;
    padding: 8px;
    background: #fff;
}

.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: linear-gradient(
        135deg,
        transparent 0%,
        transparent 46%,
        #000 46%,
        #000 50%,
        transparent 50%,
        transparent 96%,
        #000 96%
    );
}

/* Generator Content */
.generator-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 12px;
}

.generator-header h2 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.generator-header p {
    margin: 0;
    font-size: 12px;
}

.generator-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.field-row {
    display: flex;
    flex-direction: column;
}

.generator-textarea {
    width: 100%;
    min-height: 120px;
    padding: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border: 2px solid #000;
    border-top-color: #808080;
    border-left-color: #808080;
    border-right-color: #fff;
    border-bottom-color: #fff;
    background: #fff;
    resize: vertical;
}

.generator-textarea:focus {
    outline: 1px dotted #000;
    outline-offset: -2px;
}

.generator-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.char-count {
    font-size: 10px;
    color: #666;
}

.button-group {
    display: flex;
    gap: 8px;
}

/* System OS Buttons */
button {
    padding: 4px 12px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    background: #fff;
    border: 2px solid #000;
    border-top-color: #fff;
    border-left-color: #fff;
    border-right-color: #808080;
    border-bottom-color: #808080;
    box-shadow: 1px 1px 0 #000;
}

button:hover {
    background: #f0f0f0;
}

button:active {
    border-top-color: #808080;
    border-left-color: #808080;
    border-right-color: #fff;
    border-bottom-color: #fff;
    box-shadow: none;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e0e0e0;
}

.primary-btn {
    font-weight: bold;
}

/* Examples Box */
.examples-box {
    border: 2px solid #000;
    border-top-color: #808080;
    border-left-color: #808080;
    border-right-color: #fff;
    border-bottom-color: #fff;
    padding: 8px;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
}

.examples-title {
    font-weight: bold;
    margin-bottom: 8px;
}

.example-item {
    padding: 4px;
    cursor: pointer;
    font-size: 11px;
}

.example-item:hover {
    background: #000;
    color: #fff;
}

.loading-message {
    text-align: center;
    padding: 12px;
    font-style: italic;
}

/* Generated App */
.generated-app-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.generated-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

.error-message {
    padding: 20px;
    text-align: center;
    color: #c00;
    font-weight: bold;
}

/* Desktop Icons */
.desktop-icons {
    position: fixed;
    right: 20px;
    top: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 50;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 64px;
}

.icon-image {
    font-size: 32px;
    margin-bottom: 4px;
    filter: grayscale(1) contrast(2);
}

.icon-label {
    font-size: 10px;
    text-align: center;
    background: #fff;
    padding: 2px 4px;
    border: 1px solid #000;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trash-icon {
    margin-top: auto;
}

/* About Dialog */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.dialog-box {
    background: #fff;
    border: 2px solid #000;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    width: 320px;
    padding: 16px;
}

.dialog-title {
    font-weight: bold;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #000;
}

.dialog-content {
    margin-bottom: 16px;
    font-size: 12px;
}

.dialog-content p {
    margin: 4px 0;
}

.dialog-buttons {
    text-align: center;
}

/* Footer */
.desktop-footer {
    position: fixed;
    bottom: 4px;
    left: 4px;
    font-size: 10px;
    z-index: 9998;
}

.desktop-footer a {
    color: #000;
    text-decoration: none;
}

.desktop-footer a:hover {
    text-decoration: underline;
}

/* Scrollbars (WebKit) */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: url('data:image/svg+xml,<svg width="2" height="2" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" fill="%23fff"/><rect x="1" y="1" width="1" height="1" fill="%23fff"/><rect x="1" width="1" height="1" fill="%23ddd"/><rect y="1" width="1" height="1" fill="%23ddd"/></svg>');
    background-size: 2px 2px;
}

::-webkit-scrollbar-thumb {
    background: #fff;
    border: 1px solid #000;
}

::-webkit-scrollbar-button {
    background: #fff;
    border: 1px solid #000;
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-button:vertical:decrement {
    border-bottom: none;
}

::-webkit-scrollbar-button:vertical:increment {
    border-top: none;
}

/* Responsive Warning */
@media (max-width: 1024px) {
    .desktop::before {
        content: 'This app works best on desktop';
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: #fff;
        border: 2px solid #000;
        padding: 20px;
        box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
        z-index: 99999;
        font-size: 14px;
        text-align: center;
    }
}