/* Windows 98-style Desktop UI */
:root {
    --win-bg: #008080;
    --win-header: #000080;
    --win-border: #c0c0c0;
    --win-button: #c0c0c0;
    --win-text: #000000;
    --win-window-bg: #f0f0f0;
    --win-active-title: #000080;
    --win-inactive-title: #808080;
    --win-button-highlight: #ffffff;
    --win-button-shadow: #808080;
    --win-taskbar: #c0c0c0;
    --win-start: #008080;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Roboto Mono", "Courier New", Consolas, monospace;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: var(--win-text);
    height: 100vh;
}

/* Desktop */
.desktop {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: var(--win-bg);
    overflow: hidden;
}

/* Desktop Logo */
.desktop-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
    user-select: none;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    font-family: "Roboto Mono", monospace;
}

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

.icon {
    width: 100px;
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: white;
}

.icon:hover .icon-text {
    background-color: #0000aa;
}

.icon-img {
    width: 60px;
    height: 60px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-bottom: 5px;
}

.folder-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><path d="M21 9V7C21 6.44772 20.5523 6 20 6H10L9 4H4L3.21115 5.57771C3.07229 5.85542 3 6.16165 3 6.47214V9" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.91321 20H20.0868C20.604 20 21.0359 19.6056 21.0827 19.0905L21.9009 10.0905C21.9541 9.50492 21.493 9 20.905 9H3.09503C2.507 9 2.0459 9.50492 2.09914 10.0905L2.91732 19.0905C2.96415 19.6056 3.39601 20 3.91321 20Z" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    opacity: 0.9;
}

.note-icon {
    background-image: url('assets/note.svg');
    filter: invert(1); /* Makes the SVG white */
    opacity: 0.9;
    background-size: 75%; /* Increased from 65% to make it slightly larger */
}

/* For note icon in the file explorer if needed */
.explorer-item .note-icon {
    filter: none; /* No invert for explorer */
    background-size: 75%; /* Increased from 65% to make it slightly larger */
}

.research-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 14H4v-4h11v4zm0-5H4V9h11v4zm5 5h-4V9h4v9z"/></svg>');
}

.tools-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"/></svg>');
}

.about-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>');
}

.icon-text {
    font-size: 14px;
    text-align: center;
    padding: 2px 4px;
    word-break: break-word;
    width: 100%;
}

/* Windows */
.windows {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 30px);
    pointer-events: none;
}

.window {
    position: absolute;
    min-width: 300px;
    min-height: 200px;
    max-width: 80%;
    max-height: 80%;
    background: var(--win-window-bg);
    border: 2px solid var(--win-border);
    border-radius: 0;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    pointer-events: all;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    resize: none;
    overflow: auto;
}

/* Add a resize handle in the corner */
.window::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 15px;
    height: 15px;
    cursor: nwse-resize;
    background: transparent;
}

.window.active {
    border-color: var(--win-active-title);
    z-index: 100;
}

.window.maximized {
    width: 100% !important;
    height: calc(100vh - 45px) !important; /* Use viewport height and subtract taskbar height */
    max-width: 100% !important;
    max-height: calc(100vh - 45px) !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    border-radius: 0;
    resize: none;
    border-width: 0;
}

.window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--win-active-title);
    color: white;
    padding: 6px 8px;
    height: 28px;
    user-select: none;
    cursor: move;
}

.window.active .window-header {
    background-color: var(--win-active-title);
}

.window:not(.active) .window-header {
    background-color: var(--win-inactive-title);
}

.window-title {
    font-weight: bold;
    font-size: 14px;
    margin-left: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.window-controls button {
    width: 24px;
    height: 24px;
    border: 2px solid;
    border-top-color: var(--win-button-highlight);
    border-left-color: var(--win-button-highlight);
    border-right-color: var(--win-button-shadow);
    border-bottom-color: var(--win-button-shadow);
    background-color: var(--win-button);
    color: black;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    padding: 0;
    cursor: pointer;
    margin-left: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.window-controls button:hover {
    background-color: #e0e0e0;
}

.window-controls button:active {
    border-style: inset;
}

.window-content {
    flex: 1;
    padding: 10px;
    overflow: auto;
    background-color: white;
    border-top: 1px solid var(--win-border);
}

.window-content h2 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--win-text);
    border-bottom: 1px solid #cccccc;
    padding-bottom: 5px;
}

.window-content ul {
    list-style-type: square;
    margin-left: 20px;
}

.window-content li {
    margin-bottom: 8px;
}

.window-content a {
    color: #0000ff;
    text-decoration: none;
}

.window-content a:hover {
    text-decoration: underline;
}

.window-content p {
    margin-bottom: 10px;
    line-height: 1.4;
}

/* Taskbar */
.taskbar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 45px;
    background-color: var(--win-taskbar);
    display: flex;
    align-items: center;
    padding: 0 2px;
    border-top: 1px solid var(--win-button-highlight);
    z-index: 1000;
}

.start-btn {
    display: flex;
    align-items: center;
    padding: 2px 10px;
    margin-right: 4px;
    background-color: var(--win-button);
    border: 2px outset var(--win-border);
    font-weight: bold;
    font-size: 14px;
    height: 36px;
    cursor: pointer;
    white-space: nowrap;
}

.start-btn:active {
    border-style: inset;
}

.taskbar-items {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    margin: 0 4px;
    height: 36px;
}

.taskbar-item {
    padding: 2px 8px;
    background-color: var(--win-button);
    border: 2px outset var(--win-border);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    min-width: 120px;
    max-width: 200px;
    display: flex;
    align-items: center;
}

.taskbar-item.active {
    border-style: inset;
    background-color: #dcdcdc;
}

.clock {
    padding: 0 12px;
    margin-left: 10px;
    min-width: 60px;
    text-align: center;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: calc(100% - 2px);
    box-sizing: border-box;
    user-select: none;
    background-color: var(--win-button);
    border-top: 1px solid var(--win-button-shadow);
    border-left: 1px solid var(--win-button-shadow);
    border-right: 1px solid var(--win-button-highlight);
    border-bottom: 1px solid var(--win-button-highlight);
}

/* Make things boxy and pixelated for that retro look */
button, input, select, .window, .taskbar-item, .start-btn {
    border-radius: 0;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .desktop-icons {
        grid-template-columns: repeat(auto-fill, 80px);
        gap: 10px;
    }
    
    .icon {
        width: 80px;
        height: 90px;
    }
    
    .window {
        min-width: 250px;
        max-width: 95%;
    }
}

/* Start Menu */
.start-menu {
    position: absolute;
    bottom: 45px; /* Position above taskbar */
    left: 0;
    width: 220px;
    background-color: var(--win-button);
    border: 2px solid var(--win-border);
    border-top-color: var(--win-button-highlight);
    border-left-color: var(--win-button-highlight);
    border-right-color: var(--win-button-shadow);
    border-bottom-color: var(--win-button-shadow);
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none; /* Hidden by default */
}

.start-menu-header {
    height: 50px;
    background-color: var(--win-active-title);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 20px;
    font-weight: bold;
}

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

.start-menu-item {
    display: flex;
    align-items: center;
    padding: 5px;
    cursor: pointer;
    height: 40px;
    text-decoration: none;
    color: inherit;
}

.start-menu-item:hover {
    background-color: var(--win-active-title);
    color: white;
}

.start-menu-icon {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.start-menu-separator {
    height: 1px;
    background-color: var(--win-button-shadow);
    margin: 5px 0;
    border-bottom: 1px solid var(--win-button-highlight);
}

/* Make start button look pressed when menu is open */
.start-btn.active {
    border-style: inset;
    background-color: #dcdcdc;
}

/* Social Icons */
.social-icons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 2;
}

.social-icon {
    width: 100px;
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    color: white;
    text-decoration: none;
}

.social-icon:hover .icon-text {
    background-color: #0000aa;
}

.github-icon {
    background-image: url('assets/github.svg');
    filter: invert(1);
}

.linkedin-icon {
    background-image: url('assets/linkedin.svg');
    filter: invert(1);
}

.hackthebox-icon {
    background-image: url('assets/hackthebox.svg');
    filter: invert(1);
}

.hackerone-icon {
    background-image: url('assets/hackerone.svg');
    filter: invert(1);
}

/* File Explorer */
.file-explorer {
    display: flex;
    flex-direction: column;
    padding: 0 !important;
}

.explorer-header {
    padding: 5px 10px;
    background-color: var(--win-window-bg);
    border-bottom: 1px solid var(--win-border);
}

.breadcrumb {
    font-size: 14px;
    color: var(--win-text);
}

.explorer-items {
    display: flex;
    flex-wrap: wrap;
    padding: 15px;
    align-content: flex-start;
    height: 100%;
    overflow-y: auto;
}

.explorer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    height: 100px;
    margin: 10px;
    padding: 5px;
    text-decoration: none;
    color: var(--win-text);
    cursor: pointer;
}

.explorer-item:hover {
    background-color: rgba(0, 0, 255, 0.1);
}

.explorer-item span {
    text-align: center;
    font-size: 12px;
    margin-top: 4px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.small-icon {
    width: 60px;
    height: 60px;
}

/* Custom folder icon for file explorer - same as desktop but black */
.explorer-item .folder-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><path d="M21 9V7C21 6.44772 20.5523 6 20 6H10L9 4H4L3.21115 5.57771C3.07229 5.85542 3 6.16165 3 6.47214V9" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M3.91321 20H20.0868C20.604 20 21.0359 19.6056 21.0827 19.0905L21.9009 10.0905C21.9541 9.50492 21.493 9 20.905 9H3.09503C2.507 9 2.0459 9.50492 2.09914 10.0905L2.91732 19.0905C2.96415 19.6056 3.39601 20 3.91321 20Z" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    filter: none; /* Remove any filters */
    opacity: 1;
}

/* Taskbar Tray */
.taskbar-tray {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding-right: 4px;
    height: 100%;
}

.tray-icon {
    width: 16px;
    height: 16px;
    margin: 0 6px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.ethernet-icon {
    background-image: url('assets/ethernet.svg');
    filter: invert(0.2);
    cursor: default;
}

/* Mobile-specific styles */
.mobile-view {
    overflow: auto !important;
    height: auto !important;
}

.mobile-view .desktop {
    min-height: 100vh;
    padding-bottom: 60px; /* Space for taskbar */
}

.mobile-view .desktop-icons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

.mobile-view .icon {
    width: 100%;
    max-width: 300px;
    height: auto;
    padding: 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.mobile-view .icon-img {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.mobile-view .icon-text {
    font-size: 16px;
    text-align: left;
}

.mobile-view .window {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

.mobile-view .window-header {
    padding: 12px;
    height: auto;
}

.mobile-view .window-title {
    font-size: 18px;
}

.mobile-view .window-controls {
    display: none;
}

.mobile-view .window-content {
    padding: 15px;
    height: calc(100% - 50px);
    overflow-y: auto;
    padding-bottom: 70px; /* Add extra padding at bottom to prevent taskbar overlap */
}

.mobile-view .window-content p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.mobile-view .window-content ul {
    margin-bottom: 20px;
}

.mobile-view .window-content li {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.mobile-view .taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background-color: var(--win-taskbar);
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 1000;
}

.mobile-view .start-btn {
    padding: 8px 15px;
    font-size: 16px;
}

.mobile-view .taskbar-items {
    display: none;
}

.mobile-view .taskbar-tray {
    margin-left: auto;
}

.mobile-view .start-menu {
    position: fixed;
    bottom: 50px;
    left: 0;
    width: 100%;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 0;
    box-shadow: none;
}

.mobile-view .start-menu-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

.mobile-view .start-menu-item {
    padding: 12px 15px;
    font-size: 16px;
}

.mobile-view .start-menu-icon {
    width: 24px;
    height: 24px;
    margin-right: 15px;
}

.mobile-view .social-icons {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

.mobile-view .social-icon {
    width: 100%;
    max-width: 300px;
    height: auto;
    padding: 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

/* Prevent text selection on mobile */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    a, button, .icon, .start-menu-item {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}
