/* ==========================================================================
   opeBase Dark Theme v.1.0 - CSS (Created by KeMarcY and mkaroly)
   ========================================================================== */

/*? Imports & Variables
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&display=swap');

/*NOTE: To make a simple recolor theme, it's enought to change the root variables!*/
:root {
    /*Background*/
    /* You'll likely want a light background image or a solid light color */
    --background-image: url('/Assets/Wallpapers/opeBase_wp2.png'); /* Suggestion: use a light version */
    --background-color: #f0f2f5; /* Fallback or primary light background */

    /* Main UI */
    /* Icons might need to be inverted or swapped for light mode versions */
    --start-menu-image: url('/Assets/Icons/startmenu_light.png');
    --search-menu-image: url('/Assets/Icons/search_light.png');
    --sidebar-menu-image: url('/Assets/Icons/toggle_sidebar_light.png');
    --ui-color: #e9ecef; /* Main UI elements - light gray */
    --button-color: #ffffff; /* Buttons - white */
    --button-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1); /* Subtle dark shadow */
    --higlight-color: #864ddb; /* Purple, maybe slightly adjusted for light bg */
    --highlight-shadow: 0px 0px 10px 0px var(--higlight-color);
    --higlight-color-bright: #a87cdf; /* Lighter purple for hover/focus */
    --highlight-shadow-bright: 0px 0px 10px 0px var(--higlight-color-bright);

    /* Window Colors */
    --window-border-color:          #cccccc; /* Light gray border */
    --window-header-color:          #e9ecef; /* Light gray header */
    --window-background-color:      #ffffff; /* White window background */
    --transparency-texture-color:   #e0e0e0; /* Light texture for transparency */
    /* Traffic light buttons often remain consistent, but you can adjust if needed */
    --minimize-button:              #ffbd44;
    --maximize-button:              #6495ed;
    --close-button:                 #ff605c;
    --minimize-button-hover:        #ffd170;
    --maximize-button-hover:        #8cb1ed;
    --close-button-hover:           #ff8a87;

    /*Font*/
    --font-color: #212529; /* Dark gray / near black for text */
    --font-family: "Comfortaa", sans-serif;

    /*Search */
    --search-overlay-background: rgba(240, 242, 245, 0.8); /* Light semi-transparent overlay */
    --search-input-background: #ffffff; /* White input */
    --search-button-background: #f8f9fa; /* Slightly off-white button, or same as input */
    --quick-link-background-default: rgba(0,0,0,0.05); /* Very subtle dark on light */
    --quick-link-background-hover: rgba(0,0,0,0.1);  /* Subtle dark on light hover */
    --quick-link-text-color: #333333; /* Dark text for quick links */


    /*Start Menu*/
    /* These were already quite light, so minor adjustments or keep as is */
    --start-menu-item-background-default: #ffffff; /* White or very light gray */
    --start-menu-item-background-hover: #f0f0f0; /* Slightly darker gray on hover */
    --start-menu-item-text-color: #333333; /* Dark text */
    --start-menu-item-shadow-color: rgba(0, 0, 0, 0.1); /* Subtle shadow */

    /* Settings Panel Colors */
    --settings-text-color: #212529; /* Dark text for settings */
    --icon-selector-background: #f8f9fa; /* Very light gray */
    --icon-selector-border-color: #ced4da; /* Light gray border */
    --icon-selector-shadow-color: rgba(0,0,0,0.05); /* Very subtle shadow */
    --icon-selector-close-icon-color: #333333; /* Dark icon */
    --settings-overlay-background: rgba(240, 242, 245, 0.9); /* Light semi-transparent overlay */
    --settings-box-background: #ffffff; /* White settings box */
    --settings-box-shadow-color: rgba(0,0,0,0.1); /* Subtle shadow */
    --settings-box-title-color: #212529; /* Dark title text */
    --settings-button-background-default: #e9ecef; /* Light gray button */
    --settings-button-text-color: #212529; /* Dark text on button */
    --settings-button-background-hover: #dee2e6; /* Slightly darker gray on hover */
}

/*? Global Styles & Canvas
   ========================================================================== */
body {
    font-family: var(--font-family);
    color: var(--font-color);
    background-color: var(--ui-color);
    margin: 0;
    display: grid;
    grid-template-columns: 250px auto;
    grid-template-rows: 50px 1fr;
    height: 100vh;
    overflow: hidden;
}

/*? Main Layout Structure
   ========================================================================== */

/** Taskbar (Tray)
    -------------------------------------------------------------------------- */
#taskbar {
    grid-column: 2;
    grid-row: 1;
    height: 50px;
    background-color: var(--ui-color);
    box-shadow: 0px 5px 10px 0px var(--ui-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 10px;
    overflow: visible;
}

#taskbar-left,
#taskbar-center,
#taskbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
}

#taskbar-center {
    flex-grow: 1;
    overflow-x: auto;
    overflow-y: visible;
    padding-left: 10px;
    padding-bottom: 10px;
    margin-bottom: -10px;
}

#taskbar-right {
    margin-left: auto;
}

.taskbar-divider {
    background-color: var(--font-color);
    height: 25px;
    width: 1px;
    opacity: 0.5;
    align-self: center;
}

#toggle-sidebar, #start-menu, #search-menu {
    height: 40px;
    background-color: var(--button-color);
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    border-radius: 4px;
}
#toggle-sidebar { width: 20px; background-image: url("/Assets/Icons/toggle_sidebar.png"); background-size: 150%; }
#start-menu { width: 40px; background-image: url("/Assets/Icons/startmenu.png"); background-size: 90%; border-radius: 10px; }
#search-menu { width: 40px; background-image: url("/Assets/Icons/search.png"); background-size: 80%; border-radius: 10px; }


#date-time {
    display: flex;
    flex-direction: column;
    gap: 5px;
    user-select: none;
    text-align: center;
}
#timeIndicator, #dateIndicator { color: var(--font-color); margin: 0; }

/** Sidebar
    -------------------------------------------------------------------------- */
#sidebar {
    grid-row: 1 / span 2; grid-column: 1; width: 250px; max-width: 250px;
    background-color: var(--ui-color); box-shadow: 5px 0px 10px 0px var(--ui-color);
    z-index: 900; display: flex; flex-direction: column; gap: 10px;
    align-items: center; padding-top: 10px; padding-bottom: 10px;
    overflow-y: auto; overflow-x: hidden; color: var(--font-color);
}

#selectBtn {
    display: block; padding: 10px 20px; font-size: 16px; font-family: var(--font-family); color: var(--font-color);
    background-color: var(--button-color); border: none; border-radius: 10px; cursor: pointer;
    box-shadow: 0px -5px 10px 0px var(--ui-color);
    margin-bottom: 10px; width: calc(100% - 20px); box-sizing: border-box; text-align: center;
}


/** Display Area
    -------------------------------------------------------------------------- */
#display {
    grid-column: 2; grid-row: 2; position: relative;
    background-image: var(--background-image);
    background-color: var(--ui-color); background-size: cover;
    background-position: center; background-repeat: no-repeat; overflow: hidden;
}

/*? UI Components
   ========================================================================== */

/** Windows
    -------------------------------------------------------------------------- */
.window {
    position: absolute; background-color: #ffffff00; border: 1px solid var(--window-border-color);
    border-radius: 8px; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    min-width: 250px; min-height: 150px;
    overflow: hidden; /* CHANGED: This clips content to rounded corners */
    display: flex; flex-direction: column; color: var(--font-color);
    opacity: 1; transform: scale(1) translateY(0);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out,
                width 0.3s ease-in-out, height 0.3s ease-in-out,
                top 0.3s ease-in-out, left 0.3s ease-in-out;
}
.window-header {
    height: 30px; background-color: var(--window-header-color); display: flex; align-items: center;
    padding: 0 10px; cursor: move; border-bottom: 1px solid var(--window-border-color);
    flex-shrink: 0; user-select: none;
}
.window-title {
    flex-grow: 1; font-size: 14px; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.window-controls { display: flex; gap: 8px; }
.window-control {
    width: 12px; height: 12px; border-radius: 3px; cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.2); transition: background-color 0.15s ease;
}
.window-control.minimize { background-color: var(--minimize-button); }
.window-control.maximize { background-color: var(--maximize-button); }
.window-control.close    { background-color: var(--close-button); }
.window-control.minimize:hover { background-color: var(--minimize-button-hover); }
.window-control.maximize:hover { background-color: var(--maximize-button-hover); }
.window-control.close:hover    { background-color: var(--close-button-hover); }

.window-content {
    flex-grow: 1; overflow: auto; background-color: var(--window-background-color);
    display: flex; flex-direction: column;
}

#display .window-content pre {
    white-space: pre-wrap; word-wrap: break-word; margin: 0;
    font-family: Consolas, 'Courier New', monospace; padding: 10px;
    overflow: auto; height: 100%; box-sizing: border-box;
    color: var(--font-color);
}
#display .window-content code { display: block; }

.image-viewer-container, .audio-player-container, .video-player-container, .file-info-container {
    width: 100%; height: 100%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; overflow: hidden;
    padding: 10px; box-sizing: border-box; background-color: var(--button-color);
}
.image-viewer-container {
    background-image: linear-gradient(45deg, var(--transparency-texture-color) 25%, transparent 25%), linear-gradient(-45deg, var(--transparency-texture-color) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--transparency-texture-color) 75%), linear-gradient(-45deg, transparent 75%, var(--transparency-texture-color) 75%);
    background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
.image-viewer-image { max-width: 100%; max-height: 100%; display: block; object-fit: contain; }
.audio-player-container { background-color: #ffffff00; justify-content: space-around; }
.audio-player { width: 90%; max-width: 400px; }
.video-player-container { background-color: #ffffff00; justify-content: space-between; }
.video-player { max-width: 100%; max-height: calc(100% - 30px); display: block; }
.media-title {
    padding: 5px 10px; font-size: 0.9em; color: var(--font-color); text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    width: 95%; margin-top: 5px; margin-bottom: 5px; flex-shrink: 0;
}
.file-info-container { align-items: flex-start; justify-content: flex-start; background-color: var(--button-color); color: var(--font-color); }
.file-info-title { font-weight: bold; margin-bottom: 10px; font-size: 1.1em; }
.file-info-container.error { background-color: #5c3232; }
.file-info-container.error .file-info-title { color: #ff8a87; }

.resizer { position: absolute; background: transparent; z-index: 10; }
.resizer.bottom-right {
    width: 12px; height: 12px;
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
    background-color: var(--button-color);
    border-radius: 3px;
    opacity: 0.6;
}
.resizer.bottom-left  { width: 10px; height: 10px; bottom: 0; left: 0; cursor: nesw-resize; }
.resizer.top-right    { width: 10px; height: 10px; top: 0;  right: 0; cursor: nesw-resize; }
.resizer.top-left     { width: 10px; height: 10px; top: 0;  left: 0; cursor: nwse-resize; }


/** Taskbar Items (Tabs on Tray)
    -------------------------------------------------------------------------- */
.taskbar-item {
    background-color: var(--button-color);
    color: var(--font-color);
    height: 40px;
    min-width: 60px;
    max-width: 180px;
    border-radius: 10px;
    box-shadow: 0px 10px 10px 0px rgba(0,0,0,0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    user-select: none;
    flex-shrink: 0;
    filter: brightness(1);
    transition: filter 0.15s ease-in-out, box-shadow 0.2s ease, background-color 0.2s ease;
    padding: 0 10px 0 15px;
    position: relative;
}

.taskbar-item-title {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 25px;
}

.taskbar-item-close {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--font-color);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    font-weight: bold;
    opacity: 0.7;
    transition: all 0.15s ease;
}
.taskbar-item-close:hover { background-color: #ff605c; color: #500; opacity: 1; transform: translateY(-50%) scale(1.1); }
.taskbar-item-close:active { background-color: #d13c38; transform: translateY(-50%) scale(1); }


/** File Tree (Sidebar Content)
    -------------------------------------------------------------------------- */
#treeContainer {
  font-family: var(--font-family);
  font-size: 14px;
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  color: var(--font-color);
}

.tree-root {
  padding-left: 0;
  list-style: none;
  margin: 0;
}

.tree-root ul.nested {
  padding-left: 18px;
  list-style: none;
  margin: 0;
  border-left: 1px dotted #777;
}

.tree-root li {
  padding: 4px 0;
  position: relative;
}

.tree-root ul.nested > li::before {
  content: "";
  position: absolute;
  top: 12px;
  left: -10px;
  width: 8px;
  height: 1px;
  border-top: 1px dotted #777;
}
.tree-root > li.file-li::before {
    display: none;
}

.folder, .file {
  cursor: pointer;
  user-select: none;
  display: inline-block;
  padding: 3px 6px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
  width: calc(100% - 10px);
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder:hover, .file:hover {
  background-color: var(--button-color);
}

.folder .toggle {
  display: inline-block;
  width: 1em;
  text-align: center;
  margin-right: 5px;
  transition: transform 0.15s ease-in-out;
  color: #aaa;
}

.directory-li.open > .folder .toggle {
  transform: rotate(90deg);
}

.directory-li > ul.nested {
  display: none;
  margin-top: 4px;
}

.directory-li.open > ul.nested {
  display: block;
}

.hidden {
  display: none !important;
}

.directory-li.loading > .folder .toggle {
  color: var(--higlight-color);
  animation: spin 1s linear infinite;
}

/*? Search Bar
   ========================================================================== */

   #searchMenuID {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--search-overlay-background);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-in-out, pointer-events 0.5s ease-in-out;
}
 
#search-input {
    width: 100%;
    max-width: 30em;
    padding: 0.5em;
    font-size: 1.5em;
    border-radius: 0.5em;
    border: none;
    outline: none;
    background-color: var(--search-input-background);
    transition: width 0.5s ease-in-out, padding 0.5s ease-in-out;
    flex: 1 1 auto;
}

#web-search-button {
    padding: 0.5em 1em;
    font-size: 1.2em;
    border-radius: 0.5em;
    border: none;
    outline: none;
    background-color: var(--search-button-background);
    transition: background 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
}

#search-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 90%;
    max-width: 40em;
    flex-wrap: nowrap;
}

#link-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    width: 90%;
    max-width: 40em;
    justify-content: center;
}

.quick-link {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.85em;
    background: var(--quick-link-background-default);
    color: var(--quick-link-text-color);
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.2s;
}

.quick-link:hover {
    background: var(--quick-link-background-hover);
}

/*? Start Menu
   ========================================================================== */
.start-menu-item {
    position: absolute; /* Top and Left will be set by JS */
    height: 50px;
    width: 140px;
    border-radius: 12px;
    background-color: var(--start-menu-item-background-default);
    box-shadow: 0 4px 12px var(--start-menu-item-shadow-color);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--start-menu-item-text-color);
    user-select: none;
}

.start-menu-item:hover {
    background-color: var(--start-menu-item-background-hover);
    transform: translateY(-2px);
}

/* Styles previously injected by JS IIFE */
.setting-row {
    display: flex;
    align-items: center;
    margin: 14px 0;
    gap: 14px;
    font-size: 1.15em;
    color: var(--settings-text-color);
}

.setting-row img.icon {
    width: 26px;
    height: 26px;
}

#iconSelector {
    /* display: none; /* Controlled by JS */
    position: absolute; /* Top and Left will be set by JS */
    background-color: var(--icon-selector-background);
    border: 1px solid var(--icon-selector-border-color);
    border-radius: 8px;
    padding: 12px;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 200px;
    max-width: 300px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 4px 12px var(--icon-selector-shadow-color);
    z-index: 1001;
}

#iconSelector .close-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    cursor: pointer;
    font-size: 1.2em;
    color: var(--icon-selector-close-icon-color);
}

#iconSelector img.icon-option {
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-radius: 6px;
    transition: transform 0.1s ease;
}

#iconSelector img.icon-option:hover {
    transform: scale(1.1);
}

#settingsWindow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--settings-overlay-background);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#settingsBox {
    position: relative;
    width: 480px;
    max-height: 85vh;
    background-color: var(--settings-box-background);
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--settings-box-shadow-color);
    overflow-y: auto;
    padding: 24px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#settingsBox h2 {
    margin-top: 0;
    font-size: 1.6em;
    color: var(--settings-box-title-color);
    text-align: center; /* Added from JS inline style */
}

/* Generic button styles, ensure they don't conflict if other buttons exist */
#settingsBox button,
#settingsBox .setting-row button { /* More specific to avoid global button styling if not intended */
    padding: 8px 16px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: var(--settings-button-background-default);
    color: var(--settings-button-text-color);
    transition: background-color 0.2s ease;
}

#settingsBox button:hover,
#settingsBox .setting-row button:hover {
    background-color: var(--settings-button-background-hover);
}

#btnRow { /* Assuming #btnRow is inside #settingsBox */
    justify-content: flex-end;
    margin-top: 24px;
}

/*? States & Animations
   ========================================================================== */
.buttonAni, #start-menu, #search-menu, #toggle-sidebar, .actionButton {
    filter: brightness(1);
    transition: filter 0.15s ease-in-out, box-shadow 0.2s ease, transform 0.2s ease-in-out;
}
.buttonAni:hover, #start-menu:hover, #search-menu:hover, #toggle-sidebar:hover, .actionButton:hover {
    filter: brightness(1.3);
}
#toggle-sidebar:hover{ transform: scale(1.05); }


.window.is-dragging, .window.is-resizing { transition: none !important; }
.window.closing, .window.minimizing {
    opacity: 0 !important;
    transform: var(--minimize-transform, scale(0.85) translateY(30px)) !important;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 1, 1) !important;
}
.window.maximized {
    top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important;
    border-radius: 0; border: none; box-shadow: none;
}
.window.maximized .window-header { border-radius: 0; }
.window.maximized .resizer { display: none; }


/* Taskbar Item States - Using your original shadow classes */
.button-shadow{ box-shadow: 0px 10px 10px 0px rgba(0,0,0,0.5); }
.button-shadow-active{ box-shadow: 0px 10px 10px 0px rgba(40, 0, 60, 0.5); }

.taskbar-item.active {
    background-color: var(--higlight-color);
    color: var(--font-color);
    box-shadow: 0px 10px 10px 0px rgba(40, 0, 60, 0.5);
}
.taskbar-item.minimized { opacity: 0.6; filter: grayscale(50%) brightness(0.8); box-shadow: none; }
.taskbar-item.dragging { opacity: 0.5; cursor: grabbing; transform: scale(0.95); background-color: var(--higlight-color); }
.taskbar-item.drag-over-before { box-shadow: inset 4px 0 0 0 var(--higlight-color-bright), var(--highlight-shadow-bright); }
.taskbar-item.drag-over-after { box-shadow: inset -4px 0 0 0 var(--higlight-color-bright), var(--highlight-shadow-bright); }


@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }


/*? Utility Styles
   ========================================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #666; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #888; }
/* * { scrollbar-width: thin; scrollbar-color: #666 rgba(0,0,0,0.1); } */