/**
 * v86 Retro Client - Nostalgic Windows 98/2000 Theme
 */

/* CSS Variables */
:root {
    /* Windows 98 Colors */
    --win98-teal: #008080;
    --win98-silver: #c0c0c0;
    --win98-dark-gray: #808080;
    --win98-light-gray: #dfdfdf;
    --win98-navy: #000080;
    --win98-white: #ffffff;
    --win98-black: #000000;
    
    /* Windows 2000 Colors */
    --win2k-blue: #0a246a;
    --win2k-light-blue: #a6caf0;
    --win2k-gray: #d4d0c8;
    
    /* Accent Colors */
    --accent-aim-yellow: #ffcc00;
    --accent-icq-green: #00ff00;
    --accent-success: #4CAF50;
    --accent-error: #f44336;
    --accent-warning: #ff9800;
    
    /* Layout */
    --header-height: 50px;
    --toolbar-height: 40px;
}

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

/* Base */
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--win98-teal) 0%, var(--win2k-blue) 100%);
}

.hidden {
    display: none !important;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-logo h1 {
    font-size: 2.5rem;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.loading-logo img {
    max-width: 200px;
    margin-bottom: 20px;
}

.loading-subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 30px;
}

.loading-bar-container {
    width: 300px;
    height: 20px;
    background: var(--win98-dark-gray);
    border: 2px solid var(--win98-black);
    border-radius: 2px;
    margin: 0 auto 20px;
    overflow: hidden;
    /* Windows 98 style 3D border */
    box-shadow: inset 1px 1px 0 var(--win98-black),
                inset -1px -1px 0 var(--win98-white);
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        var(--win98-navy) 0%,
        var(--win2k-light-blue) 50%,
        var(--win98-navy) 100%);
    background-size: 200% 100%;
    animation: loadingPulse 1s ease-in-out infinite;
    transition: width 0.3s ease;
}

@keyframes loadingPulse {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.loading-text {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Main App */
.app {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--win98-silver);
}

/* Header */
.header {
    height: var(--header-height);
    background: linear-gradient(180deg, 
        var(--win98-navy) 0%,
        var(--win2k-blue) 50%,
        var(--win98-navy) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    /* Windows title bar style */
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),
                0 2px 4px rgba(0,0,0,0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h1 {
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.tagline {
    font-size: 0.8rem;
    opacity: 0.7;
    font-style: italic;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 3px;
    font-size: 0.9rem;
    background: rgba(0,0,0,0.2);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #888;
}

.status-indicator.offline .status-dot { background: #888; }
.status-indicator.connecting .status-dot { 
    background: var(--accent-warning); 
    animation: pulse 1s infinite;
}
.status-indicator.running .status-dot { background: var(--accent-success); }
.status-indicator.error .status-dot { background: var(--accent-error); }

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

/* Profile Selection Screen */
.profile-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, 
        var(--win98-teal) 0%, 
        var(--win2k-blue) 100%);
}

.profile-container {
    max-width: 1000px;
    width: 100%;
    background: var(--win98-silver);
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-gray) var(--win98-dark-gray) var(--win98-white);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
    padding: 30px;
}

.profile-container h2 {
    text-align: center;
    color: var(--win98-navy);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.profile-subtitle {
    text-align: center;
    color: var(--win98-dark-gray);
    margin-bottom: 30px;
}

/* Profiles Grid */
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.profile-loading {
    text-align: center;
    padding: 40px;
    color: var(--win98-dark-gray);
    font-style: italic;
}

/* Profile Card */
.profile-card {
    background: white;
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-gray) var(--win98-dark-gray) var(--win98-white);
    padding: 20px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}

.profile-card.unavailable {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.profile-name {
    font-size: 1.3rem;
    color: var(--win98-navy);
    margin-bottom: 10px;
}

.profile-description {
    font-size: 0.9rem;
    color: var(--win98-dark-gray);
    margin-bottom: 15px;
    line-height: 1.4;
}

.profile-status {
    margin-bottom: 15px;
}

.profile-status .status {
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 10px;
}

.profile-status .ready {
    background: #d4edda;
    color: #155724;
}

.profile-status .not-ready {
    background: #fff3cd;
    color: #856404;
}

/* Buttons */
.btn {
    padding: 8px 20px;
    font-size: 1rem;
    cursor: pointer;
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-gray) var(--win98-dark-gray) var(--win98-white);
    background: var(--win98-silver);
    font-family: inherit;
    transition: all 0.1s ease;
}

.btn:hover:not(:disabled) {
    background: var(--win98-light-gray);
}

.btn:active:not(:disabled) {
    border-color: var(--win98-dark-gray) var(--win98-white) var(--win98-white) var(--win98-dark-gray);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--win98-navy);
    color: white;
    border-color: var(--win2k-light-blue) var(--win98-black) var(--win98-black) var(--win2k-light-blue);
}

.btn-primary:hover:not(:disabled) {
    background: var(--win2k-blue);
}

.btn-secondary {
    background: var(--win98-silver);
    color: var(--win98-black);
}

/* Profile Info Section */
.profile-info {
    background: #ffffcc;
    border: 1px solid #cccc00;
    padding: 20px;
    margin-top: 20px;
}

.profile-info h3 {
    color: var(--win98-navy);
    margin-bottom: 15px;
}

.profile-info ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.profile-info li {
    margin-bottom: 8px;
    line-height: 1.4;
}

.requirements {
    font-size: 0.9rem;
    color: var(--win98-dark-gray);
    margin-top: 10px;
}

/* No Profiles Section */
.no-profiles {
    margin-top: 20px;
}

.alert {
    padding: 15px 20px;
    border: 1px solid;
    margin-bottom: 20px;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert h4 {
    margin-bottom: 10px;
}

.manual-start {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.manual-start h4 {
    margin-bottom: 15px;
    color: var(--win98-dark-gray);
}

/* Emulator Screen */
.emulator-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--win98-black);
}

/* Emulator Toolbar */
.emulator-toolbar {
    height: var(--toolbar-height);
    background: var(--win98-silver);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 5px;
    border-bottom: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-gray) var(--win98-dark-gray) var(--win98-white);
}

.toolbar-btn {
    padding: 5px 12px;
    font-size: 0.85rem;
    background: var(--win98-silver);
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-gray) var(--win98-dark-gray) var(--win98-white);
    cursor: pointer;
    font-family: inherit;
}

.toolbar-btn:hover {
    background: var(--win98-light-gray);
}

.toolbar-btn:active {
    border-color: var(--win98-dark-gray) var(--win98-white) var(--win98-white) var(--win98-dark-gray);
}

.toolbar-spacer {
    flex: 1;
}

.emulator-status {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--win98-dark-gray);
}

.status-cpu, .status-net {
    background: white;
    padding: 3px 10px;
    border: 1px solid var(--win98-dark-gray);
}

/* Screen Container */
.screen-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--win98-black);
    position: relative;
    overflow: hidden;
}

#screen_wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vga-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    cursor: default;
}

.cursor-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Fullscreen styles */
.screen-container:fullscreen {
    background: black;
}

.screen-container:fullscreen .vga-canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Serial Terminal (hidden by default) */
.serial-terminal {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: black;
    color: #00ff00;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    padding: 10px;
    overflow-y: auto;
}

/* Emulator Footer */
.emulator-footer {
    background: var(--win98-silver);
    padding: 8px 15px;
    border-top: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-gray) var(--win98-dark-gray) var(--win98-white);
}

.tips {
    font-size: 0.85rem;
    color: var(--win98-dark-gray);
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .header-left h1 {
        font-size: 1rem;
    }
    
    .tagline {
        display: none;
    }
    
    .profile-container {
        padding: 15px;
    }
    
    .profiles-grid {
        grid-template-columns: 1fr;
    }
    
    .emulator-toolbar {
        flex-wrap: wrap;
        height: auto;
        padding: 5px;
    }
    
    .toolbar-btn {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    #keyboard-hint {
        display: none;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    .profile-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .toolbar-btn:hover {
        background: var(--win98-silver);
    }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 500px;
    padding: 15px 20px;
    background: var(--win98-silver);
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-gray) var(--win98-dark-gray) var(--win98-white);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
    font-family: 'MS Sans Serif', Arial, sans-serif;
    font-size: 14px;
}

.notification.persistent {
    position: fixed;
    top: 80px;
    animation: slideIn 0.5s ease;
}

.notification.success {
    border-left: 4px solid var(--accent-success);
}

.notification.error {
    border-left: 4px solid var(--accent-error);
}

.notification.info {
    border-left: 4px solid var(--win2k-blue);
}

.notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notification-text {
    flex: 1;
}

.btn-restore, .btn-clear {
    padding: 6px 12px;
    border: 2px solid;
    border-color: var(--win98-white) var(--win98-dark-gray) var(--win98-dark-gray) var(--win98-white);
    background: var(--win98-silver);
    cursor: pointer;
    font-family: 'MS Sans Serif', Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
}

.btn-restore:hover {
    background: var(--win98-light-gray);
}

.btn-restore:active {
    border-color: var(--win98-dark-gray) var(--win98-white) var(--win98-white) var(--win98-dark-gray);
    padding: 7px 11px 5px 13px;
}

.btn-clear {
    background: #e0e0e0;
}

.btn-clear:hover {
    background: #d0d0d0;
}

.btn-clear:active {
    border-color: var(--win98-dark-gray) var(--win98-white) var(--win98-white) var(--win98-dark-gray);
    padding: 7px 11px 5px 13px;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Print styles - hide everything */
@media print {
    body {
        display: none;
    }
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-overlay-content {
    text-align: center;
    color: white;
    max-width: 500px;
    width: 90%;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #0078D7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-message {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: white;
}

.loading-progress {
    margin-top: 15px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0078D7, #4CAF50);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}
