/* Import Pixel Font */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* CSS Variables - Retro OS Theme */
:root {
    --desktop-bg: #008080;
    --window-bg: #c0c0c0;
    --window-border: #ffffff;
    --window-border-dark: #808080;
    --window-titlebar: linear-gradient(90deg, #000080, #1084d0);
    --taskbar-bg: #c0c0c0;
    --button-face: #c0c0c0;
    --button-highlight: #ffffff;
    --button-shadow: #808080;
    --button-dark-shadow: #000000;
    --text-primary: #000000;
    --text-white: #ffffff;
    --selection-bg: #000080;
    --selection-text: #ffffff;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Press Start 2P', cursive;
    background: var(--desktop-bg);
    height: 100vh;
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    cursor: default;
}

/* Desktop */
.desktop {
    height: calc(100vh - 40px);
    position: relative;
    padding: 10px;
    overflow: hidden;
}

/* Desktop Icons */
.desktop-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, 80px);
    gap: 20px;
    grid-auto-flow: column;
}

.desktop-icon {
    width: 80px;
    text-align: center;
    cursor: pointer;
    padding: 8px;
    user-select: none;
}

.desktop-icon:hover {
    background: rgba(0, 0, 128, 0.3);
    outline: 1px dotted var(--text-white);
}

.desktop-icon.selected {
    background: rgba(0, 0, 128, 0.5);
    outline: 1px dotted var(--text-white);
}

.icon-image {
    font-size: 32px;
    margin-bottom: 4px;
    filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.5));
}

.icon-label {
    font-size: 8px;
    color: var(--text-white);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.4;
    word-wrap: break-word;
}

/* Windows */
.window {
    position: absolute;
    min-width: 300px;
    max-width: 600px;
    background: var(--window-bg);
    border-top: 2px solid var(--window-border);
    border-left: 2px solid var(--window-border);
    border-right: 2px solid var(--window-border-dark);
    border-bottom: 2px solid var(--window-border-dark);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.window.active {
    z-index: 100;
}

.window-titlebar {
    background: var(--window-titlebar);
    padding: 3px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    touch-action: none;
    /* Prevents page scroll when dragging on mobile */
}

.window-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-white);
    font-size: 10px;
    font-weight: bold;
}

.window-icon {
    font-size: 14px;
}

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

.window-btn {
    width: 18px;
    height: 18px;
    background: var(--button-face);
    border-top: 2px solid var(--button-highlight);
    border-left: 2px solid var(--button-highlight);
    border-right: 2px solid var(--button-dark-shadow);
    border-bottom: 2px solid var(--button-dark-shadow);
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    line-height: 1;
}

.window-btn:active {
    border-top: 2px solid var(--button-dark-shadow);
    border-left: 2px solid var(--button-dark-shadow);
    border-right: 2px solid var(--button-highlight);
    border-bottom: 2px solid var(--button-highlight);
    padding-left: 2px;
    padding-top: 2px;
}

.close-btn:hover {
    background: #ff0000;
    color: var(--text-white);
}

.window-content {
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--window-bg);
}

/* Custom Scrollbar */
.window-content::-webkit-scrollbar {
    width: 16px;
}

.window-content::-webkit-scrollbar-track {
    background: var(--window-bg);
    border-left: 2px solid var(--window-border-dark);
}

.window-content::-webkit-scrollbar-thumb {
    background: var(--button-face);
    border-top: 2px solid var(--button-highlight);
    border-left: 2px solid var(--button-highlight);
    border-right: 2px solid var(--button-dark-shadow);
    border-bottom: 2px solid var(--button-dark-shadow);
}

/* Profile Container */
.profile-container {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.profile-avatar {
    position: relative;
    width: 100px;
    height: 100px;
    border-top: 2px solid var(--window-border-dark);
    border-left: 2px solid var(--window-border-dark);
    border-right: 2px solid var(--button-highlight);
    border-bottom: 2px solid var(--button-highlight);
}

.avatar-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.status-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--window-bg);
}

.status-indicator.online {
    background: #00ff00;
    box-shadow: 0 0 4px #00ff00;
}

.profile-info {
    flex: 1;
}

.profile-username {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.profile-role {
    font-size: 8px;
    color: var(--button-shadow);
    margin-bottom: 12px;
}

.profile-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.stat-item {
    display: flex;
    gap: 8px;
    font-size: 8px;
}

.stat-label {
    color: var(--button-shadow);
}

.stat-value {
    color: var(--text-primary);
    font-weight: bold;
}

.xp-bar-container {
    height: 16px;
    background: var(--window-bg);
    border-top: 2px solid var(--window-border-dark);
    border-left: 2px solid var(--window-border-dark);
    border-right: 2px solid var(--button-highlight);
    border-bottom: 2px solid var(--button-highlight);
    position: relative;
    overflow: hidden;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0000ff, #00ffff);
    transition: width 1s ease;
}

/* File List */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    font-size: 10px;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
}

.file-item:hover {
    background: var(--selection-bg);
    color: var(--selection-text);
}

.file-icon {
    font-size: 16px;
}

.file-name {
    flex: 1;
}

/* Social Links */
.social-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--button-face);
    border-top: 2px solid var(--button-highlight);
    border-left: 2px solid var(--button-highlight);
    border-right: 2px solid var(--button-dark-shadow);
    border-bottom: 2px solid var(--button-dark-shadow);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 9px;
    cursor: pointer;
}

.social-link:hover {
    background: var(--selection-bg);
    color: var(--selection-text);
}

.social-link:active {
    border-top: 2px solid var(--button-dark-shadow);
    border-left: 2px solid var(--button-dark-shadow);
    border-right: 2px solid var(--button-highlight);
    border-bottom: 2px solid var(--button-highlight);
}

.social-icon {
    font-size: 20px;
}

.social-name {
    flex: 1;
}

/* About Content */
.about-content {
    font-size: 9px;
    line-height: 1.8;
    color: var(--text-primary);
}

.about-content h3 {
    font-size: 12px;
    margin-bottom: 12px;
}

.about-content p {
    margin-bottom: 6px;
}

/* Taskbar */
.taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: var(--taskbar-bg);
    border-top: 2px solid var(--button-highlight);
    display: flex;
    align-items: center;
    padding: 2px 4px;
    gap: 4px;
    z-index: 1000;
}

.start-button {
    height: 32px;
    padding: 0 12px;
    background: var(--button-face);
    border-top: 2px solid var(--button-highlight);
    border-left: 2px solid var(--button-highlight);
    border-right: 2px solid var(--button-dark-shadow);
    border-bottom: 2px solid var(--button-dark-shadow);
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.start-button:active,
.start-button.active {
    border-top: 2px solid var(--button-dark-shadow);
    border-left: 2px solid var(--button-dark-shadow);
    border-right: 2px solid var(--button-highlight);
    border-bottom: 2px solid var(--button-highlight);
}

.start-icon {
    font-size: 14px;
}

.taskbar-apps {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.taskbar-app {
    height: 32px;
    padding: 0 12px;
    background: var(--button-face);
    border-top: 2px solid var(--button-highlight);
    border-left: 2px solid var(--button-highlight);
    border-right: 2px solid var(--button-dark-shadow);
    border-bottom: 2px solid var(--button-dark-shadow);
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    white-space: nowrap;
}

.taskbar-app.active {
    border-top: 2px solid var(--button-dark-shadow);
    border-left: 2px solid var(--button-dark-shadow);
    border-right: 2px solid var(--button-highlight);
    border-bottom: 2px solid var(--button-highlight);
}

.app-icon {
    font-size: 14px;
}

.system-tray {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    border-left: 2px solid var(--window-border-dark);
    height: 32px;
}

.tray-icon {
    font-size: 14px;
    cursor: pointer;
}

.system-clock {
    font-size: 9px;
    color: var(--text-primary);
    min-width: 50px;
    text-align: center;
}

/* Start Menu */
.start-menu {
    position: fixed;
    bottom: 42px;
    left: 4px;
    width: 250px;
    background: var(--window-bg);
    border-top: 2px solid var(--button-highlight);
    border-left: 2px solid var(--button-highlight);
    border-right: 2px solid var(--button-dark-shadow);
    border-bottom: 2px solid var(--button-dark-shadow);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 1001;
}

.start-menu.show {
    display: block;
    animation: menu-appear 0.2s ease-out;
}

@keyframes menu-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.start-menu-header {
    background: var(--window-titlebar);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-small {
    width: 40px;
    height: 40px;
    border: 2px solid var(--text-white);
}

.user-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.user-info-small {
    flex: 1;
}

.user-name-small {
    font-size: 10px;
    color: var(--text-white);
    font-weight: bold;
    margin-bottom: 4px;
}

.user-status-small {
    font-size: 7px;
    color: rgba(255, 255, 255, 0.8);
}

.start-menu-items {
    padding: 4px;
}

.start-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 9px;
    color: var(--text-primary);
    cursor: pointer;
}

.start-menu-item:hover {
    background: var(--selection-bg);
    color: var(--selection-text);
}

.menu-item-icon {
    font-size: 16px;
}

.start-menu-separator {
    height: 2px;
    background: var(--window-border-dark);
    margin: 4px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .desktop-icons {
        grid-template-columns: repeat(auto-fill, 70px);
        gap: 15px;
    }

    .desktop-icon {
        width: 70px;
    }

    .icon-image {
        font-size: 28px;
    }

    .icon-label {
        font-size: 7px;
    }

    .window {
        min-width: 250px;
        max-width: calc(100vw - 20px);
    }

    .window-title {
        font-size: 9px;
    }

    .profile-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .start-menu {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .taskbar {
        height: 36px;
    }

    .start-button {
        height: 28px;
        padding: 0 8px;
        font-size: 8px;
    }

    .taskbar-app {
        height: 28px;
        padding: 0 8px;
        font-size: 8px;
    }

    .system-clock {
        font-size: 8px;
        min-width: 40px;
    }

    .desktop {
        height: calc(100vh - 36px);
    }

    .window-content {
        max-height: 300px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}