/* General Styles */
* {
    box-sizing: border-box;
}

:root {
    --google-blue: #4285F4;
    --google-red: #DB4437;
    --google-yellow: #F4B400;
    --google-green: #0F9D58;
    --background-color: #E9EAEB;
    --header-background: rgba(255, 255, 255, 0.85);
    --window-background: rgba(255, 255, 255, 0.7);
    --folder-bar-background: rgba(228, 231, 235, 0.9);
    --shadow-light: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-heavy: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    --font-color: #202124;
    --border-color: #dadce0;
}

body.dark-theme {
    --background-color: #202124;
    --header-background: rgba(40, 40, 40, 0.85);
    --window-background: rgba(40, 40, 40, 0.7);
    --folder-bar-background: rgba(50, 50, 50, 0.9);
    --font-color: #e8eaed;
    --border-color: #5f6368;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--font-color);
    overflow: hidden; /* Hide scrollbars on the body */
}

#app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header (mostly unchanged) */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background-color: var(--header-background);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: relative; /* Changed from fixed */
    z-index: 1000;
}

.header-left { margin-right: 20px; margin-left: 20px; }
.header-right { display: flex; align-items: center; }
.search-form { display: flex; max-width: 400px; }
.search-input { border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 12px; font-size: 14px; margin-right: 8px; flex-grow: 1; background-color: var(--background-color); color: var(--font-color); }
.search-input:focus { outline: none; border-color: var(--google-blue); }
.search-button { border: none; background-color: var(--google-blue); color: white; padding: 8px 16px; border-radius: 8px; font-weight: 500; cursor: pointer; transition: opacity 0.2s ease-in-out; }
.search-button:hover { opacity: 0.8; }
.profile-link { width: 40px; height: 40px; border-radius: 50%; background-image: url('Images/Profile.png'); background-size: cover; background-position: center; transition: opacity 0.2s ease-in-out; flex-shrink: 0; margin-left: 20px; }
.profile-link:hover { opacity: 0.8; }
.header-title { margin: 0 0 0 20px; background-image: url('Images/GDeskLogo.png'); background-size: contain; background-repeat: no-repeat; background-position: center; width: 40px; height: 13px; text-indent: -9999px; }

/* Desktop Layout */
#desktop {
    flex-grow: 1;
    display: flex;
    position: relative; /* This will be the container for windows */
}

#folder-bar {
    width: 80px;
    background-color: var(--folder-bar-background);
    backdrop-filter: blur(10px);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    border-right: 1px solid var(--border-color);
    z-index: 100;
}

.folder {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-align: center;
}

.folder-align-bottom {
    margin-top: auto;
    margin-bottom: 20px;
}

.folder-icon {
    width: 25px;
    height: 25px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    margin-bottom: 5px;
    transition: transform 0.2s ease;
}

.folder:hover .folder-icon {
    transform: scale(1.1);
}

.folder-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--font-color);
}

/* Window Styles */
.window {
    position: absolute;
    width: 500px;
    min-height: 150px;
    background-color: var(--window-background);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: var(--shadow-heavy);
    display: flex;
    flex-direction: column;
    z-index: 200; /* Default z-index */
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.window.open {
    opacity: 1;
    transform: scale(1);
}

.window.active {
    z-index: 300; /* Higher z-index for the active window */
}

.window-header {
    height: 30px;
    background-color: rgba(0, 0, 0, 0.05);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    cursor: move; /* Indicate it's draggable */
}

.window-title {
    font-weight: 500;
    font-size: 14px;
}

.window-close-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    line-height: 16px;
    text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.window-close-btn::after {
    content: '×';
}

.window-close-btn-red { background-color: var(--google-red); }
.window-close-btn-blue { background-color: var(--google-blue); }
.window-close-btn-green { background-color: var(--google-green); }
.window-close-btn-yellow { background-color: var(--google-yellow); }


.window-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-content: flex-start;
    overflow-y: auto;
}

.text-window-content {
    font-size: 12px;
    display: block;
}

/* Service Icon Styles (inside windows) */
.service-icon {
    width: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--font-color);
}

.service-icon-img {
    width: 25px;
    height: 25px;
    margin-bottom: 8px;
    transition: transform 0.2s ease;
}

.service-icon:hover .service-icon-img {
    transform: scale(1.15);
}

.service-icon-name {
    font-size: 12px;
    font-weight: 400;
    /* Allow word wrapping for longer names */
    word-break: break-word;
}


/* Background & Date/Time (mostly unchanged) */
#wallpaper-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Places it behind all content */
    opacity: 0.15; /* Makes the wallpaper semi-transparent */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    transition: background-image 0.3s ease-in-out;
}

#datetime-container {
    position: fixed;
    top: 85px;
    right: 40px;
    color: var(--font-color);
    font-family: 'Roboto', sans-serif;
    text-align: right;
    z-index: 50;
}

#time { font-size: 20px; font-weight: 500; }
#date { font-size: 12px; }

#stock-price {
    font-size: 12px;
    font-weight: 500;
    color: var(--font-color);
    text-align: right;
    margin-right: 20px;
}

/* Note Widget Styles */
.new-note-button {
    border: none;
    background-color: var(--google-yellow);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
    margin-top: 20px;
}

.new-note-button:hover {
    opacity: 0.8;
}

.note-widget {
    position: absolute;
    width: 240px;
    height: 240px;
    background-color: #ffc;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    /* padding removed, will be on children */
}

.note-header {
    width: 100%;
    height: 25px;
    background-color: #f2e8a4;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: flex-end; /* To push close button to the right */
    padding: 0 5px;
    cursor: move;
}

.note-widget textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    resize: none;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    color: #333;
    padding: 10px;
}

.note-widget textarea:focus {
    outline: none;
}

.note-close-btn {
    width: 19px;
    height: 19px;
    background: var(--google-yellow);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 19px;
    text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.note-close-btn:hover {
    background: rgba(0,0,0,0.2);
}

/* Theme-toggle */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 44px;
}

.theme-switch input {
    display:none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: .4s;
    width: 16px;
}

input:checked + .slider {
    background-color: var(--google-blue);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}
