/* ============================================
   gamelicensor.pro - Retro Workstation Styles
   ============================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

body {
    background: #0C0C14;
    color: #F2A900;
    font-family: 'VT323', monospace;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0.05em;
    overflow-x: hidden;
}

/* CRT Scanline Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        transparent 0px,
        transparent 2px,
        rgba(0,0,0,0.03) 2px,
        rgba(0,0,0,0.03) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 14px;
}
::-webkit-scrollbar-track {
    background: #C8C0B0;
    border-left: 1px solid #808078;
    border-right: 1px solid #E8E0D8;
}
::-webkit-scrollbar-thumb {
    background: #A0988C;
    border-top: 2px solid #E8E0D8;
    border-left: 2px solid #E8E0D8;
    border-bottom: 2px solid #808078;
    border-right: 2px solid #808078;
}

/* ============================================
   BOOT SCREEN
   ============================================ */
#boot-screen {
    width: 100%;
    min-height: 100vh;
    background: #0C0C14;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
}

#crt-line {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 2px;
    background: #F2A900;
    box-shadow: 0 0 12px rgba(242, 169, 0, 0.5);
    opacity: 0;
    transition: none;
}

#crt-line.active {
    animation: crt-expand 600ms ease-out forwards;
}

@keyframes crt-expand {
    0% {
        width: 0;
        opacity: 1;
    }
    100% {
        width: 100%;
        opacity: 1;
    }
}

#crt-line.done {
    opacity: 0;
    transition: opacity 300ms;
}

#boot-text-container {
    width: 100%;
    max-width: 700px;
    padding: 40px 24px;
    opacity: 0;
}

#boot-text-container.visible {
    opacity: 1;
}

.boot-line {
    font-family: 'VT323', monospace;
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: 0.05em;
    color: #F2A900;
    text-shadow: 0 0 8px rgba(242, 169, 0, 0.4);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.boot-line.revealed {
    opacity: 1;
    transform: translateY(0);
}

.cursor-blink {
    animation: blink 800ms step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ============================================
   DESKTOP
   ============================================ */
#desktop {
    width: 100%;
    min-height: 100vh;
    background: #1A1A2A;
    background-image:
        linear-gradient(0deg, #222238 1px, transparent 1px),
        linear-gradient(90deg, #222238 1px, transparent 1px);
    background-size: 8px 8px;
    position: relative;
    opacity: 0;
    transition: opacity 800ms ease;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}

#desktop.visible {
    opacity: 1;
}

/* Menu Bar */
#menu-bar {
    width: 100%;
    height: 28px;
    background: #C8C0B0;
    border-bottom: 1px solid #808078;
    border-top: 1px solid #E8E0D8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    transform: translateY(-28px);
    transition: transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
    flex-shrink: 0;
}

#desktop.visible #menu-bar {
    transform: translateY(0);
}

#menu-left {
    display: flex;
    gap: 16px;
}

.menu-item {
    font-family: 'Silkscreen', cursive;
    font-size: 13px;
    font-weight: 700;
    color: #2A2420;
    cursor: default;
    padding: 2px 6px;
}

.menu-item:hover {
    background: #4488CC;
    color: #F4F0E8;
}

.menu-apple {
    font-weight: 700;
}

#menu-right {
    display: flex;
    align-items: center;
}

#menu-clock {
    font-family: 'VT323', monospace;
    font-size: 13px;
    color: #2A2420;
}

/* Desktop Icons */
#desktop-icons {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 32px;
    padding: 48px 48px;
}

.desktop-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 200ms ease, transform 200ms ease;
    width: 80px;
}

.desktop-icon.visible {
    opacity: 1;
    transform: scale(1);
}

.desktop-icon:hover .icon-svg {
    filter: brightness(1.2) drop-shadow(0 0 6px rgba(68, 136, 204, 0.5));
}

.desktop-icon:hover .icon-label {
    background: #4488CC;
    color: #F4F0E8;
}

.icon-svg {
    filter: drop-shadow(2px 2px 0 rgba(12, 12, 20, 0.3));
    transition: filter 200ms ease;
}

.icon-label {
    font-family: 'VT323', monospace;
    font-size: 12px;
    color: #F2A900;
    text-align: center;
    line-height: 1.3;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
    padding: 1px 4px;
    transition: background 150ms, color 150ms;
}

/* ============================================
   WINDOWS AREA
   ============================================ */
#windows-area {
    width: 100%;
    background: #1A1A2A;
    background-image:
        linear-gradient(0deg, #222238 1px, transparent 1px),
        linear-gradient(90deg, #222238 1px, transparent 1px);
    background-size: 8px 8px;
    padding: 3px;
}

#bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 3px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

/* ---- Application Window ---- */
.app-window {
    grid-column: span 6;
    background: #F4F0E8;
    border-top: 2px solid #E8E0D8;
    border-left: 2px solid #E8E0D8;
    border-bottom: 2px solid #808078;
    border-right: 2px solid #808078;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.02);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
    min-height: 400px;
}

.app-window.visible {
    opacity: 1;
    transform: scale(1);
}

.app-window.window-full {
    grid-column: span 12;
    min-height: 500px;
}

/* Window Title Bar */
.window-titlebar {
    height: 22px;
    background: linear-gradient(180deg, #D8D0C0, #B8B0A0);
    border-bottom: 1px solid #808078;
    display: flex;
    align-items: center;
    padding: 0 6px;
    cursor: grab;
    flex-shrink: 0;
}

.window-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.win-btn {
    width: 12px;
    height: 12px;
    border-radius: 0;
    border-top: 1px solid #E8E0D8;
    border-left: 1px solid #E8E0D8;
    border-bottom: 1px solid #808078;
    border-right: 1px solid #808078;
    cursor: pointer;
}

.win-btn:hover {
    border-top: 1px solid #808078;
    border-left: 1px solid #808078;
    border-bottom: 1px solid #E8E0D8;
    border-right: 1px solid #E8E0D8;
}

.btn-close { background: #E05040; }
.btn-minimize { background: #E0C040; }
.btn-zoom { background: #40C060; }

.window-title {
    font-family: 'Silkscreen', cursive;
    font-size: 14px;
    font-weight: 700;
    color: #2A2420;
    margin-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.window-buttons-spacer {
    flex: 1;
}

/* Window Content */
.window-content {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    background: #F4F0E8;
}

.window-heading {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(18px, 2.5vw, 28px);
    font-weight: 700;
    color: #2A2420;
    margin-bottom: 16px;
}

.window-body-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: clamp(15px, 1.6vw, 18px);
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: #3A3430;
    margin-top: 16px;
}

/* ============================================
   TERRITORY MAP
   ============================================ */
#territory-map {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
    max-width: 500px;
}

.map-row {
    display: flex;
    gap: 2px;
}

.map-cell {
    width: 100%;
    aspect-ratio: 1.6;
    transition: background 200ms, box-shadow 200ms;
    cursor: pointer;
    position: relative;
}

.map-cell.licensed { background: #40C060; }
.map-cell.pending  { background: #E0C040; }
.map-cell.unlicensed { background: #808078; }
.map-cell.water { background: #1A1A2A; cursor: default; }

.map-cell:not(.water):hover {
    background: #4488CC;
    box-shadow: 0 0 6px rgba(68, 136, 204, 0.5);
}

.tooltip-box {
    display: none;
    background: #0C0C14;
    border: 2px solid #F2A900;
    padding: 6px 12px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #F2A900;
    text-shadow: 0 0 8px rgba(242, 169, 0, 0.4);
    margin-bottom: 12px;
}

.tooltip-box.active {
    display: flex;
    gap: 12px;
}

.map-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #6A6458;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid #808078;
}

.legend-swatch.licensed { background: #40C060; }
.legend-swatch.pending  { background: #E0C040; }
.legend-swatch.unlicensed { background: #808078; }

/* ============================================
   DOCUMENT ARCHIVE
   ============================================ */
.window-content-split {
    display: flex;
    gap: 0;
    padding: 0;
}

/* File Sidebar */
.file-sidebar {
    width: 220px;
    min-width: 220px;
    background: #EAE6DE;
    border-right: 2px solid #808078;
    padding: 12px 0;
    overflow-y: auto;
}

.folder {
    cursor: pointer;
    user-select: none;
}

.folder > .folder-icon,
.folder > .folder-name {
    display: inline;
    padding: 4px 12px;
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #2A2420;
}

.folder > .folder-icon {
    color: #D4B878;
    padding-right: 4px;
}

.folder > .folder-name {
    padding-left: 0;
}

.folder:hover > .folder-name {
    color: #4488CC;
}

.folder-children {
    display: none;
    padding-left: 28px;
}

.folder.open > .folder-children {
    display: block;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #2A2420;
}

.file-item:hover {
    background: #4488CC;
    color: #F4F0E8;
}

.file-item.active {
    background: #4488CC;
    color: #F4F0E8;
}

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

/* File Main Pane */
.file-main-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    background: linear-gradient(180deg, #D8D0C0, #B8B0A0);
    border-bottom: 1px solid #808078;
    padding: 4px 12px;
    font-family: 'Silkscreen', cursive;
    font-size: 12px;
    font-weight: 700;
    color: #2A2420;
}

#file-table-body {
    border-bottom: 1px solid #C8C0B0;
}

.file-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    padding: 4px 12px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #2A2420;
    cursor: pointer;
    transition: background 100ms;
}

.file-row:nth-child(even) {
    background: #EAE6DE;
}

.file-row:nth-child(odd) {
    background: #F4F0E8;
}

.file-row:hover {
    background: #4488CC;
    color: #F4F0E8;
}

.file-row.active {
    background: #4488CC;
    color: #F4F0E8;
}

.status-approved {
    color: #40C060;
}

.status-pending {
    color: #E0C040;
}

.file-row:hover .status-approved,
.file-row:hover .status-pending,
.file-row.active .status-approved,
.file-row.active .status-pending {
    color: #F4F0E8;
}

/* Document Viewer */
#document-viewer {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #F4F0E8;
}

.doc-content h3 {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 700;
    color: #2A2420;
    margin-bottom: 12px;
}

.doc-content p {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: clamp(15px, 1.6vw, 18px);
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: #3A3430;
    margin-bottom: 12px;
}

/* ============================================
   SYSTEM LOG (Terminal Window)
   ============================================ */
.window-content-terminal {
    background: #0C0C14;
    padding: 16px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #40C060;
    min-height: 350px;
    overflow-y: auto;
}

#system-log-output {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.log-entry {
    line-height: 1.4;
    opacity: 0;
    transition: opacity 200ms;
    white-space: nowrap;
}

.log-entry.visible {
    opacity: 1;
}

.log-ts {
    color: #808078;
}

.log-action {
    color: #40C060;
}

.log-detail {
    color: #F2A900;
}

/* ============================================
   SHUTDOWN SECTION
   ============================================ */
#shutdown-section {
    width: 100%;
    min-height: 50vh;
    background: #1A1A2A;
    background-image:
        linear-gradient(0deg, #222238 1px, transparent 1px),
        linear-gradient(90deg, #222238 1px, transparent 1px);
    background-size: 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
    padding: 48px 16px;
}

#shutdown-dialog {
    width: 400px;
    max-width: 90%;
    background: #F4F0E8;
    border-top: 2px solid #E8E0D8;
    border-left: 2px solid #E8E0D8;
    border-bottom: 2px solid #808078;
    border-right: 2px solid #808078;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 500ms ease, transform 500ms ease;
}

#shutdown-dialog.visible {
    opacity: 1;
    transform: scale(1);
}

.dialog-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.dialog-icon svg {
    display: block;
}

.dialog-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 15px;
    font-weight: 400;
    color: #2A2420;
    text-align: center;
    line-height: 1.6;
}

.dialog-buttons {
    display: flex;
    gap: 12px;
}

.dialog-btn {
    font-family: 'Silkscreen', cursive;
    font-size: 13px;
    font-weight: 700;
    color: #2A2420;
    background: #C8C0B0;
    border-top: 2px solid #E8E0D8;
    border-left: 2px solid #E8E0D8;
    border-bottom: 2px solid #808078;
    border-right: 2px solid #808078;
    padding: 6px 20px;
    cursor: pointer;
    outline: none;
    transition: border 100ms;
}

.dialog-btn:hover {
    border-top: 2px solid #808078;
    border-left: 2px solid #808078;
    border-bottom: 2px solid #E8E0D8;
    border-right: 2px solid #E8E0D8;
}

.dialog-btn:active {
    border-top: 2px solid #808078;
    border-left: 2px solid #808078;
    border-bottom: 2px solid #E8E0D8;
    border-right: 2px solid #E8E0D8;
    background: #B8B0A0;
}

#footer-text {
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: #F2A900;
    text-shadow: 0 0 8px rgba(242, 169, 0, 0.4);
    margin-top: 32px;
    opacity: 0;
    transition: opacity 800ms ease;
}

#footer-text.visible {
    opacity: 1;
}

/* ============================================
   RESPONSIVE (below 768px)
   ============================================ */
@media (max-width: 768px) {
    #bento-grid {
        grid-template-columns: 1fr;
        padding: 8px;
    }

    .app-window,
    .app-window.window-full {
        grid-column: span 1;
        min-height: auto;
    }

    #desktop-icons {
        padding: 32px 16px;
        gap: 24px;
        justify-content: center;
    }

    .window-content-split {
        flex-direction: column;
    }

    .file-sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 2px solid #808078;
        max-height: 200px;
    }

    .file-table-header,
    .file-row {
        grid-template-columns: 2fr 1fr;
    }

    .col-type,
    .col-date,
    .file-row > span:nth-child(2),
    .file-row > span:nth-child(3) {
        display: none;
    }

    #shutdown-dialog {
        width: 90%;
    }

    #boot-text-container {
        padding: 24px 16px;
    }
}
