/* =========================================
   TOS SYSTEM STYLESHEET (v8.0 - Final)
   ========================================= */

/* --- 1. KONFIGURACJA I RESET --- */
:root {
    --bg: #0f0f0f;
    --panel: #1b1b1b;
    --border: #333;
    --accent: #556B2F; /* Oliwkowy (Dark Olive Green) */
    --accent-hover: #6B8E23;
    --text: #e0e0e0;
    --taskbar-h: 40px;
    --win-shadow: 0 10px 30px rgba(0,0,0,0.5);
    --font-ui: 'Segoe UI', Roboto, Helvetica, sans-serif;
}

* { 
    box-sizing: border-box; 
    outline: none !important; 
    -webkit-tap-highlight-color: transparent;
}

body, html { 
    margin: 0; padding: 0; width: 100%; height: 100%; 
    overflow: hidden; 
    font-family: var(--font-ui); font-size: 13px;
    background: var(--bg); color: var(--text);
    user-select: none; -webkit-user-select: none;
    touch-action: none; 
    overscroll-behavior: none;
}

/* --- 2. PULPIT --- */
#desktop { 
    position: absolute; top: 0; left: 0; right: 0; bottom: var(--taskbar-h);
    background: url('../img/wallpaper-pc.webp') no-repeat center center fixed;
    background-size: cover;
    background-color: #000;
    overflow: hidden; 
}

/* Przyciemnienie tapety */
#desktop::after {
    content: ''; position: absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.1); pointer-events: none; z-index: 0;
}

/* --- 3. IKONY --- */
.icon { 
    width: 86px; height: 100px; 
    position: absolute; 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: default; 
    border: 1px solid transparent; border-radius: 4px;
    color: #ddd; z-index: 1;
    transition: background 0.1s, border-color 0.1s;
}

.icon:hover { background: rgba(255,255,255,0.05); }

.icon.selected { 
    background: rgba(85, 107, 47, 0.4); 
    border: 1px solid var(--accent-hover); 
    backdrop-filter: blur(4px);
}

.icon:active { transform: scale(0.98); }

.icon i { 
    font-size: 36px; margin-bottom: 8px; 
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8)); 
    pointer-events: none; 
}

.icon span { 
    text-align: center; width: 100%; 
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; 
    padding: 1px 4px; 
    text-shadow: 0 1px 2px #000; 
    pointer-events: none; 
}

/* Kolory ikon */
.c-sys { color: #6B8E23 !important; } 
.c-app { color: #f0ad4e !important; } 
.c-doc { color: #ddd !important; } 
.c-game { color: #d63384 !important; } 

/* --- 4. OKNA --- */
.win {
    position: absolute; 
    display: flex; flex-direction: column;
    background: var(--panel); border: 1px solid var(--border);
    box-shadow: var(--win-shadow);
    overflow: hidden;
    opacity: 0; 
    transform: scale(0.95);
    /* Animacja otwierania */
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.win.visible { opacity: 1; transform: scale(1); }

/* Stan: Zmaksymalizowane */
.win.maximized { 
    top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; 
    border: none; border-radius: 0; transform: none;
    box-shadow: none;
}

/* Stan: Snapped (Połówki ekranu) - płynna animacja */
.win.snapped {
    border-radius: 0 !important;
    transition: width 0.2s cubic-bezier(0.2, 0, 0.2, 1), 
                height 0.2s cubic-bezier(0.2, 0, 0.2, 1), 
                top 0.2s cubic-bezier(0.2, 0, 0.2, 1), 
                left 0.2s cubic-bezier(0.2, 0, 0.2, 1);
}

.win-head {
    flex: 0 0 30px; 
    background: #202020; border-bottom: 1px solid #2a2a2a;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 8px; cursor: default; 
    user-select: none;
}

.win.active .win-head { 
    background: #2a2a2a; /* Aktywne okno nieco jaśniejsze */
    color: #fff; 
}

.win-title { 
    font-weight: 600; pointer-events: none; letter-spacing: 0.3px; 
    white-space: nowrap; overflow: hidden; font-size: 12px; display: flex; align-items: center; gap: 8px;
}

.win-ctrls { display: flex; gap: 2px; }

.btn { 
    width: 28px; height: 22px; border: none; background: transparent; color: #aaa; 
    display: flex; align-items: center; justify-content: center; 
    cursor: pointer; border-radius: 2px; font-size: 11px;
}
.btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-close:hover { background: #c42b1c; color: #fff; }

.win-content { 
    flex: 1 1 auto; position: relative; min-height: 0; 
    background: #121212; 
    overflow: auto; /* Scrollowanie */
    cursor: auto; user-select: text;
}

.resizer { 
    position: absolute; bottom: 0; right: 0; width: 15px; height: 15px; 
    cursor: nwse-resize; z-index: 100; 
    background: linear-gradient(135deg, transparent 50%, var(--border) 50%); 
}

/* --- 5. PASEK ZADAŃ --- */
#taskbar { 
    position: absolute; bottom: 0; left: 0; width: 100%; height: var(--taskbar-h); 
    background: rgba(20, 20, 20, 0.95); 
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); 
    display: flex; align-items: center; padding: 0 0 0 4px; z-index: 9999; 
    
    /* FIX: Usuwamy padding z prawej, żeby przycisk ShowDesktop dotykał krawędzi */
    padding-right: 0 !important;
}

.start { 
    color: #fff; padding: 0 12px; height: 32px; 
    display: flex; align-items: center; font-weight: bold; margin-right: 6px; 
    cursor: pointer; border-radius: 3px; 
    transition: 0.2s; font-size: 14px;
	gap: 8px; 
	margin-left: 5px;
}
.start:hover { background: rgba(255,255,255,0.1); }
.start.active { background: var(--accent); color: #fff; }

.icon-svg {
    width: 1.2em;  /* Dopasowanie do wielkości tekstu */
    height: 1.2em;
}

#tasks { display: flex; flex: 1; gap: 2px; overflow: hidden; height: 100%; align-items: center; }

.task { 
    height: 32px; padding: 0 12px; min-width: 60px; max-width: 180px; 
    background: transparent; color: #bbb; border-bottom: 2px solid transparent;
    display: flex; align-items: center; cursor: pointer; border-radius: 3px; 
    transition: 0.2s;
}
.task:hover { background: rgba(255,255,255,0.05); }
.task.active { 
    background: rgba(255,255,255,0.08); 
    color: #fff; 
    border-bottom: 2px solid var(--accent); 
}
.task span { 
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; 
}

/* --- TRAY: Zegar & Show Desktop --- */

#clock {
    padding: 0 15px; 
    color: #fff;
    font-size: 12px;
    cursor: default;
    display: flex; align-items: center; justify-content: center;
    height: 100%;
    border-left: 1px solid transparent;
}
#clock:hover { background: rgba(255,255,255,0.05); }

.show-desktop-btn {
    width: 18px; 
    height: 100%; 
    border-left: 1px solid rgba(255, 255, 255, 0.1); 
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}
.show-desktop-btn:hover { background: rgba(255, 255, 255, 0.15); }
.show-desktop-btn:active { background: rgba(255, 255, 255, 0.25); }


/* --- 6. MENU START (Dark Olive v2.0) --- */
.start-menu {
    position: absolute;
    bottom: 40px; left: 0;
    width: 320px; height: 480px;
    
    background: rgba(28, 28, 28, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid #3a3a3a;
    border-bottom: none; border-left: none;
    border-radius: 0 12px 0 0;
    
    box-shadow: 10px -10px 40px rgba(0,0,0,0.6);
    display: flex; flex-direction: column;
    z-index: 10000;
    
    opacity: 0; transform: translateY(15px);
    pointer-events: none;
    transition: opacity 0.2s ease-out, transform 0.2s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.start-menu.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

.start-header {
    padding: 24px 24px 20px 24px;
    display: flex; align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.start-header .avatar {
    width: 54px; height: 54px;
    background: var(--accent); color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin-right: 16px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.start-header .user-info { display: flex; flex-direction: column; }
.start-header .greeting { font-size: 12px; color: #888; margin-bottom: 2px; }
.start-header .username { font-size: 18px; font-weight: 700; color: #fff; }

.start-body {
    flex: 1; padding: 20px;
    display: grid; grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 90px; gap: 12px;
    overflow-y: auto;
}

.quick-tile {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; color: #ccc;
}
.quick-tile:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.quick-tile .tile-icon { font-size: 26px; color: var(--accent-hover); margin-bottom: 8px; }
.quick-tile span { font-size: 12px; font-weight: 500; }

.start-footer {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex; justify-content: flex-end;
}

.power-btn {
    background: transparent; border: none; color: #aaa;
    font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 4px; transition: 0.2s;
}
.power-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* --- 7. SCROLLBARS --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }