/* Windows CSS - Windows XP Style */

/* Windows Container */
#windows-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--taskbar-height);
    pointer-events: none;
}

#windows-container > * {
    pointer-events: auto;
}

/* Window chrome */
.window {
    position: absolute;
    isolation: isolate;
    box-sizing: border-box;
    padding: 0;
    background: #7697c9;
    border: 3px solid #7697c9;
    border-radius: 8px 8px 2px 2px;
    box-shadow:
        0 0 0 1px #31557f,
        2px 3px 1px rgba(7, 36, 83, 0.26),
        6px 9px 22px rgba(8, 27, 58, 0.28),
        inset 1px 1px 0 rgba(255, 255, 255, 0.7),
        inset -1px -1px 0 rgba(29, 72, 124, 0.75);
    display: flex;
    flex-direction: column;
    min-width: 200px;
    min-height: 150px;
    opacity: 0;
    transform: translateY(14px) scale(0.94);
    transform-origin: center top;
    transition:
        opacity var(--xp-motion-window) var(--xp-ease-out),
        transform var(--xp-motion-window) var(--xp-ease-out),
        border-color var(--xp-motion-fast) ease-out,
        background-color var(--xp-motion-fast) ease-out,
        box-shadow var(--xp-motion-fast) ease-out;
}

.window::before {
    content: '';
    position: absolute;
    z-index: 4;
    top: -2px;
    left: 8px;
    right: 8px;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95) 18%, rgba(255,255,255,0.42) 78%, transparent);
    pointer-events: none;
}

.window.active {
    z-index: 1000;
    background: #0054e3;
    border-color: #0054e3;
    box-shadow:
        0 0 0 1px #003c99,
        2px 3px 1px rgba(0, 29, 98, 0.3),
        7px 12px 26px rgba(5, 25, 61, 0.34),
        inset 1px 1px 0 rgba(126, 188, 255, 0.95),
        inset -1px -1px 0 rgba(0, 45, 166, 0.9);
}

.window.active .title-bar {
    background: linear-gradient(180deg, #3d95ff 0%, #1778ec 8%, #0565db 70%, #034ebf 92%, #003c9f 100%);
}

.window.maximized {
    border-width: 0;
    border-radius: 0;
    box-shadow: inset 0 -2px 0 #003c99;
}

.window.minimizing,
.window.restoring,
.window.geometry-transitioning {
    pointer-events: none;
}

.window.geometry-transitioning {
    will-change: transform;
}

.window.dragging,
.window.resizing {
    transition: none;
    user-select: none;
    box-shadow:
        0 0 0 1px #003c99,
        3px 5px 1px rgba(0, 29, 98, 0.26),
        10px 16px 30px rgba(5, 25, 61, 0.38),
        inset 1px 1px 0 rgba(126, 188, 255, 0.95),
        inset -1px -1px 0 rgba(0, 45, 166, 0.9);
}

/* Title bar */
.title-bar {
    position: relative;
    min-height: 27px;
    padding: 2px 3px 2px 5px;
    border: 0;
    border-radius: 5px 5px 0 0;
    background: linear-gradient(180deg, #a7b9d0 0%, #829dbc 8%, #6886aa 70%, #526f94 92%, #3d5c82 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    cursor: default;
    font: 700 12px Tahoma, 'Segoe UI', sans-serif;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.55);
}

.title-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255,255,255,0.24), transparent 17%, transparent 82%, rgba(0,31,116,0.2));
    pointer-events: none;
}

.title-bar::after {
    content: '';
    position: absolute;
    left: 5px;
    right: 5px;
    bottom: 1px;
    height: 1px;
    background: rgba(0, 40, 145, 0.46);
    pointer-events: none;
}

.window.focus-pulse .title-bar::before {
    animation: xp-title-focus 260ms ease-out both;
}

@keyframes xp-title-focus {
    0% { opacity: 0.3; transform: translateX(-5px); }
    45% { opacity: 1; }
    100% { opacity: 1; transform: translateX(0); }
}

.window.maximized .title-bar {
    border-radius: 0;
}

.title-bar-text {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

.title-bar-text span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-bar-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    flex-shrink: 0;
    object-fit: contain;
    image-rendering: auto;
}

/* Title bar controls */
.title-bar-controls {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 2px;
    margin-left: 8px;
    flex-shrink: 0;
}

.title-bar-controls button {
    position: relative;
    width: 21px;
    min-width: 21px;
    height: 21px;
    min-height: 21px;
    padding: 0;
    border: 1px solid #fff;
    border-radius: 4px;
    display: grid;
    place-items: center;
    cursor: pointer;
    background:
        radial-gradient(circle at 28% 18%, rgba(255,255,255,0.92), transparent 31%),
        linear-gradient(180deg, #78b8ff 0%, #3a91f1 40%, #0b61ce 54%, #0846ad 100%);
    box-shadow:
        inset 1px 1px 0 rgba(255,255,255,0.74),
        inset -1px -1px 0 rgba(0,31,122,0.78),
        0 1px 0 rgba(0,22,83,0.62);
    transition:
        border-color var(--xp-motion-fast) var(--xp-ease-out),
        box-shadow var(--xp-motion-fast) var(--xp-ease-out),
        transform var(--xp-motion-fast) var(--xp-ease-out),
        opacity var(--xp-motion-fast) var(--xp-ease-out);
}

.title-bar-controls button:hover {
    border-color: #fff;
    background:
        radial-gradient(circle at 28% 18%, rgba(255,255,255,0.98), transparent 34%),
        linear-gradient(180deg, #9ed0ff 0%, #55a5f9 43%, #176ed4 56%, #0a4eb6 100%);
    box-shadow:
        inset 1px 1px 0 rgba(255,255,255,0.9),
        inset -1px -1px 0 rgba(0,31,122,0.82),
        0 2px 2px rgba(0,25,90,0.48);
    transform: translateY(-1px) scale(1.03);
}

.title-bar-controls button:active {
    border-color: #dcecff;
    background: linear-gradient(180deg, #0c4eae 0%, #1c6fd4 58%, #4c9aec 100%);
    box-shadow: inset 1px 1px 1px rgba(0,23,91,0.74), inset -1px -1px 0 rgba(255,255,255,0.45);
    transform: translateY(1px) scale(0.96);
}

.title-bar-controls button:focus-visible {
    outline: 1px dotted #fff;
    outline-offset: 1px;
}

.window:not(.active) .title-bar-controls button {
    opacity: 0.76;
    filter: saturate(0.62);
}

/* Crisp control glyphs */
.window-control-glyph {
    position: relative;
    display: block;
    width: 13px;
    height: 13px;
    pointer-events: none;
}

.minimize-btn .window-control-glyph::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 1px;
    width: 9px;
    height: 2px;
    background: #fff;
    box-shadow: 1px 1px 0 rgba(0, 28, 93, 0.72);
    transform: translateX(-50%);
}

.maximize-btn .window-control-glyph::before {
    content: '';
    position: absolute;
    box-sizing: border-box;
    top: 50%;
    left: 50%;
    width: 11px;
    height: 10px;
    border: 2px solid #fff;
    border-top-width: 3px;
    box-shadow: 1px 1px 0 rgba(0, 28, 93, 0.6);
    transform: translate(-50%, -50%);
}

.window.maximized .maximize-btn .window-control-glyph::before,
.window.maximized .maximize-btn .window-control-glyph::after {
    content: '';
    position: absolute;
    box-sizing: border-box;
    width: 9px;
    height: 8px;
    border: 2px solid #fff;
    border-top-width: 3px;
    background: transparent;
    box-shadow: 1px 1px 0 rgba(0, 28, 93, 0.6);
}

.window.maximized .maximize-btn .window-control-glyph::before {
    top: 1px;
    right: 1px;
    left: auto;
    transform: none;
}

.window.maximized .maximize-btn .window-control-glyph::after {
    left: 1px;
    bottom: 1px;
}

.close-btn .window-control-glyph::before,
.close-btn .window-control-glyph::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 13px;
    height: 2px;
    border-radius: 1px;
    background: #fff;
    box-shadow: 1px 1px 0 rgba(92, 14, 0, 0.72);
    transform-origin: center;
}

.close-btn .window-control-glyph::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.close-btn .window-control-glyph::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.close-btn {
    background:
        radial-gradient(circle at 28% 18%, rgba(255,255,255,0.92), transparent 31%),
        linear-gradient(180deg, #f7a181 0%, #e86838 41%, #c93416 54%, #96220f 100%) !important;
    border-color: #fff0e9 !important;
}

.close-btn:hover {
    background:
        radial-gradient(circle at 28% 18%, #fff, transparent 34%),
        linear-gradient(180deg, #ffb08e 0%, #f37645 42%, #df421d 56%, #aa210c 100%) !important;
    border-color: #fff !important;
}

.close-btn:active {
    background: linear-gradient(180deg, #97220f 0%, #c23818 56%, #ec7040 100%) !important;
    border-color: #ffd8c8 !important;
}

/* Window body */
.window-body {
    flex: 1;
    margin: 0;
    background: white;
    overflow: auto;
    position: relative;
    border-top: 1px solid #083c96;
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.82);
}

/* Menu Bar */
.menu-bar {
    background: #ECE9D8;
    border-bottom: 1px solid #D4D0C8;
    display: flex;
    padding: 2px 0;
    font-size: 11px;
}

.menu-item {
    padding: 4px 8px;
    cursor: pointer;
    user-select: none;
}

.menu-item:hover {
    background: #316AC5;
    color: white;
}

/* Status Bar */
.status-bar {
    background: #ECE9D8;
    border-top: 1px solid #D4D0C8;
    padding: 2px 4px;
    font-size: 11px;
    display: flex;
    gap: 10px;
}

.status-bar span {
    padding: 0 4px;
    border-left: 1px solid #D4D0C8;
}

.status-bar span:first-child {
    border-left: none;
}

/* Toolbar */
.toolbar {
    background: #ECE9D8;
    border-bottom: 1px solid #D4D0C8;
    padding: 4px;
    display: flex;
    gap: 4px;
}

.toolbar button {
    padding: 4px 8px;
    font-size: 11px;
}

/* Form Controls */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
}

.form-control {
    width: 100%;
    padding: 4px;
    border: 1px solid #7F9DB9;
    background: white;
    font-family: 'Tahoma', sans-serif;
    font-size: 11px;
}

.form-control:focus {
    outline: 1px solid #0054E3;
    outline-offset: -1px;
}

textarea.form-control {
    resize: vertical;
}

/* Buttons */
.submit-btn,
.view-btn,
.filter-btn {
    background: linear-gradient(
        to bottom,
        #FFFFFF 0%,
        #ECE9D8 100%
    );
    border: 1px solid #003C74;
    border-radius: 3px;
    padding: 4px 12px;
    font-size: 11px;
    cursor: pointer;
    min-width: 75px;
}

.submit-btn:hover,
.view-btn:hover,
.filter-btn:hover {
    background: linear-gradient(
        to bottom,
        #FFFFFF 0%,
        #E3E0D0 100%
    );
}

.submit-btn:active,
.view-btn:active,
.filter-btn:active {
    background: linear-gradient(
        to bottom,
        #E3E0D0 0%,
        #FFFFFF 100%
    );
}

.filter-btn.active {
    background: #316AC5;
    color: white;
    border-color: #316AC5;
}

/* Tabs */
.skills-tabs,
.tabs {
    display: flex;
    border-bottom: 1px solid #D4D0C8;
    background: #ECE9D8;
}

.tab-btn {
    padding: 6px 12px;
    background: none;
    border: 1px solid transparent;
    border-bottom: none;
    cursor: pointer;
    font-size: 11px;
    margin-bottom: -1px;
}

.tab-btn:hover {
    background: #F1EFE2;
}

.tab-btn.active {
    background: white;
    border-color: #D4D0C8;
    border-bottom-color: white;
}

.tab-content {
    display: none;
    padding: 15px;
}

.tab-content.active {
    display: block;
}

/* Skill Bars */
.skill-item {
    margin-bottom: 10px;
}

.skill-name {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
}

.skill-bar {
    height: 16px;
    background: #ECE9D8;
    border: 1px solid #7F9DB9;
    position: relative;
}

.skill-progress {
    height: 100%;
    background: linear-gradient(
        to bottom,
        #4A94F6 0%,
        #316AC5 100%
    );
    transition: width 0.5s ease;
}

/* Framework Grid */
.framework-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.framework-card {
    padding: 10px;
    text-align: center;
    background: #ECE9D8;
    border: 1px solid #D4D0C8;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
}

.framework-card:hover {
    background: #316AC5;
    color: white;
    border-color: #316AC5;
}

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

.social-link {
    color: #0054E3;
    text-decoration: none;
    font-size: 11px;
}

.social-link:hover {
    text-decoration: underline;
}

/* PDF Viewer */
.resume-viewer,
.pdf-viewer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pdf-toolbar {
    background: #ECE9D8;
    border-bottom: 1px solid #D4D0C8;
    padding: 4px;
    display: flex;
    gap: 4px;
}

.pdf-btn {
    padding: 4px 8px;
    font-size: 11px;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
}

.pdf-btn:hover {
    background: #F1EFE2;
    border-color: #D4D0C8;
}

.pdf-frame {
    flex: 1;
    border: none;
    background: white;
}

/* IE Browser */
.ie-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ie-toolbar {
    background: #ECE9D8;
    border-bottom: 1px solid #D4D0C8;
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ie-btn {
    padding: 4px 8px;
    font-size: 16px;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    min-width: 30px;
}

.ie-btn:hover {
    background: #F1EFE2;
    border-color: #D4D0C8;
}

.ie-address-bar {
    flex: 1;
    padding: 4px;
    border: 1px solid #7F9DB9;
    font-size: 11px;
}

.ie-frame {
    flex: 1;
    border: none;
    background: white;
}

/* Media Player */
.media-player-content {
    background: black;
    color: white;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.player-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.visualizer {
    width: 300px;
    height: 100px;
    background: linear-gradient(
        to bottom,
        #00FF00 0%,
        #00AA00 50%,
        #005500 100%
    );
    opacity: 0.5;
}

.player-controls {
    background: #333;
    padding: 10px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.player-btn {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.player-info {
    background: #222;
    padding: 10px;
    text-align: center;
    font-size: 12px;
}

/* Paint */
.paint-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.paint-toolbar {
    background: #ECE9D8;
    border-bottom: 1px solid #D4D0C8;
    padding: 4px;
    display: flex;
    gap: 4px;
}

.tool-btn {
    width: 30px;
    height: 30px;
    font-size: 16px;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
}

.tool-btn:hover {
    background: #F1EFE2;
    border-color: #D4D0C8;
}

.tool-btn.active {
    background: #316AC5;
    border-color: #316AC5;
}

.paint-colors {
    background: #ECE9D8;
    border-bottom: 1px solid #D4D0C8;
    padding: 4px;
    display: flex;
    gap: 4px;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border: 1px solid #000;
    cursor: pointer;
}

.color-swatch:hover {
    border-width: 2px;
}

.paint-canvas {
    flex: 1;
    background: white;
    cursor: crosshair;
}

/* Minesweeper */
.minesweeper-content {
    background: #C0C0C0;
    padding: 10px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #BDBDBD;
    border: 2px inset #DFDFDF;
    padding: 5px;
    margin-bottom: 10px;
}

.mine-counter,
.timer {
    background: black;
    color: red;
    font-family: 'Digital', monospace;
    font-size: 20px;
    padding: 2px 5px;
    min-width: 40px;
    text-align: center;
}

.new-game-btn {
    font-size: 20px;
    background: #C0C0C0;
    border: 2px outset #DFDFDF;
    cursor: pointer;
    padding: 2px 5px;
}

.new-game-btn:active {
    border-style: inset;
}

.game-board {
    background: #BDBDBD;
    border: 3px inset #DFDFDF;
    display: inline-block;
}

/* Solitaire */
.solitaire-content {
    background: #008000;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.solitaire-toolbar {
    background: #ECE9D8;
    border-bottom: 1px solid #D4D0C8;
    padding: 4px;
}

.solitaire-board {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-placeholder {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.3);
}

/* Recycle Bin */
.recycle-bin-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.file-list {
    flex: 1;
    padding: 20px;
    overflow: auto;
}

.empty-message {
    text-align: center;
    color: #666;
    margin-top: 50px;
}

.empty-message img {
    width: 64px;
    height: 64px;
    opacity: 0.5;
    margin-bottom: 10px;
}

/* Animations */
@keyframes window-open {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes window-close {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .window {
        max-width: calc(100vw - 8px);
        max-height: calc((var(--real-vh, 1vh) * 100) - var(--taskbar-height));
    }

    .title-bar {
        min-height: 30px;
    }

    .title-bar-controls button {
        width: 24px;
        min-width: 24px;
        height: 24px;
        min-height: 24px;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .control-panel-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@keyframes window-restore {
    from {
        opacity: 0;
        transform: translateY(22px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .window,
    .window.restoring,
    .window.geometry-transitioning,
    .window.focus-pulse .title-bar::before,
    .title-bar-controls button {
        animation: none !important;
        transition: none !important;
    }

    .window.minimizing {
        transform: none !important;
    }
}
