/* ベース設定 */
:root {
    --bg-primary: #2D1B69;
    --bg-secondary: #1A103F;
    --accent: #8A2BE2;
    --window-bg: rgba(28, 28, 28, 0.85);
    --text-primary: #FFFFFF;
    --taskbar-height: 50px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    color: var(--text-primary);
}

/* デスクトップ */
#desktop {
    height: calc(100vh - var(--taskbar-height));
    position: relative;
    overflow: auto;
    scrollbar-width: none; /* Firefox用 */
    -ms-overflow-style: none;/* IE/Edge用 */
}

/* Webkit (Chrome, Safari)用のスクロールバー非表示 */
#desktop::-webkit-scrollbar {
    display: none;
}

/* デスクトップアイコン */
#desktop-icons {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 80px);
    gap: 20px;
    min-height: 100%;
}

.desktop-icon {
    width: 80px;
    height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.desktop-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.desktop-icon .icon {
    font-size: 32px;
    margin-bottom: 5px;
}

.desktop-icon .icon-image {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-bottom: 5px;
}

.desktop-icon .name {
    font-size: 12px;
    text-align: center;
    word-break: break-word;
}

/* ウィンドウ */
.window {
    position: absolute;
    background: var(--window-bg);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    min-width: 300px;
    min-height: 200px;
    animation: windowOpen 0.3s ease-out;
}

.window-header {
    display: flex;
    align-items: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px 10px 0 0;
}

.window-title {
    flex-grow: 1;
    margin-left: 8px;
    font-size: 14px;
}

.window-controls {
    display: flex;
    gap: 8px;
}

.window-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.window-close { background: #FF5F56; }
.window-minimize { background: #FFBD2E; }
.window-maximize { background: #27C93F; }

.window-content {
    padding: 16px;
    height: calc(100% - 40px);
    overflow: auto;
}

/* タスクバー */
#taskbar {
    height: var(--taskbar-height);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
}

#start-button {
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
}

#start-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

#running-apps {
    display: flex;
    gap: 8px;
    margin-left: 16px;
    flex-grow: 1;
}

/* 検索バー */
#search-container {
    display: flex;
    align-items: center;
    margin-right: 16px;
    flex-grow: 1;
    max-width: 600px;
}

#search-bar {
    width: 100%;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    padding: 0 16px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

#search-bar:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    outline: none;
}

#search-bar::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* スタートメニュー */
#start-menu {
    position: fixed;
    bottom: var(--taskbar-height);
    left: 16px;
    background: var(--window-bg);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    width: 300px;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: menuOpen 0.2s ease-out;
    z-index: 1001;
}

.apps-list {
    padding: 16px;
    display: grid;
    gap: 8px;
}

.app-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.app-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.app-item .icon {
    font-size: 24px;
    margin-right: 12px;
}

.app-item .icon-image {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-right: 12px;
}

/* アニメーション */
@keyframes windowOpen {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes menuOpen {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hidden {
    display: none;
}

/* コンテキストメニュー */
.context-menu {
    position: fixed;
    background: var(--window-bg);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
}

.context-menu-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.context-menu-item .icon {
    margin-right: 12px;
    font-size: 1.2em;
}

.context-menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}
