/* ============================================
   MAIN APP
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    user-select: none;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.app-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #0f172a;
}

.app-nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.app-nav .bookmark {
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-nav .bookmark:hover {
    background: #e2e8f0;
}

.app-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    min-height: 400px;
}

/* ============================================
   WINDOWS TASKBAR (fixed bottom)
   ============================================ */
.win-taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(240, 240, 240, 0.92);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    z-index: 10000;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 4px;
    transform: translateY(100%);
    transition: transform 0.2s ease;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.win-taskbar.visible {
    transform: translateY(0);
}

.win-taskbar .task-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 4px;
    font-size: 0.78rem;
    color: #1a1a2e;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.1s;
    height: 32px;
}

.win-taskbar .task-item:hover {
    background: rgba(0, 0, 0, 0.08);
}

.win-taskbar .task-item .icon {
    font-size: 1rem;
}

.win-taskbar .task-item .label {
    font-weight: 500;
}

/* ============================================
   WINDOW (Floating, draggable, resizeable)
   ============================================ */
.win-window {
    position: fixed;
    min-width: 400px;
    min-height: 300px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25), 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.12);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, opacity 0.15s;
    opacity: 1;
}

.win-window.minimized {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9);
    transition: opacity 0.2s, transform 0.2s;
}

.win-window.maximized {
    border-radius: 0 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    box-shadow: none;
    border: none;
}

.win-window.maximized .win-titlebar .win-controls .btn-maximize svg {
    transform: rotate(0deg);
}

.win-window.maximized .win-titlebar .win-controls .btn-maximize svg rect:last-child {
    display: block;
}

/* Title bar */
.win-titlebar {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 8px 8px 0 0;
    cursor: default;
    flex-shrink: 0;
    height: 32px;
    border-bottom: 1px solid #d0d0d0;
}

.win-titlebar .win-icon {
    font-size: 1rem;
    margin-right: 6px;
}

.win-titlebar .win-title {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.win-titlebar .win-controls {
    display: flex;
    gap: 4px;
}

.win-titlebar .win-controls button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #333;
    transition: background 0.1s;
}

.win-titlebar .win-controls button:hover {
    background: rgba(0, 0, 0, 0.08);
}

.win-titlebar .win-controls .btn-close:hover {
    background: #e81123;
    color: white;
}

.win-titlebar .win-controls .btn-maximize svg,
.win-titlebar .win-controls .btn-minimize svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.win-titlebar .win-controls .btn-maximize svg rect:last-child {
    display: none;
}

.win-titlebar .win-controls .btn-maximize {
    /* normal state: maximize icon */
}

/* Address bar */
.win-addressbar {
    display: flex;
    align-items: center;
    padding: 2px 10px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    height: 30px;
    gap: 6px;
}

.win-addressbar .win-nav {
    display: flex;
    gap: 2px;
    color: #666;
    font-size: 0.9rem;
}

.win-addressbar .win-nav span {
    padding: 2px 4px;
    cursor: default;
    opacity: 0.5;
}

.win-addressbar .win-url {
    flex: 1;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 16px;
    padding: 2px 12px;
    font-size: 0.78rem;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    min-width: 0;
}

.win-addressbar .win-url .lock {
    font-size: 0.7rem;
    opacity: 0.6;
}

.win-addressbar .win-url .domain {
    font-weight: 500;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.win-addressbar .win-url .path {
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.win-addressbar .win-actions {
    display: flex;
    gap: 2px;
    color: #666;
    font-size: 0.9rem;
}

.win-addressbar .win-actions span {
    padding: 2px 4px;
    cursor: default;
    opacity: 0.5;
}

/* Content area */
.win-content {
    flex: 1;
    background: #ffffff;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    position: relative;
}

.win-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.win-content .loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 0.85rem;
}

.win-content .loading .spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e8e8e8;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Resize handle */
.win-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: se-resize;
    background: transparent;
    z-index: 10;
}

.win-resize::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #b0b0b0;
    border-bottom: 2px solid #b0b0b0;
}

/* Responsive */
@media (max-width: 600px) {
    .win-window {
        min-width: 90vw;
        min-height: 70vh;
    }
}