/* GTK Kanagawa Border Theme に基づくWeb用スタイル */
:root {
    --accent-bg: #b6a3a8;
    --accent-fg: #efdde1;
    
    --destructive-bg: #fcecef;
    --destructive-fg: #dcd7ba;
    
    --window-bg: #f8e0d6;
    --window-fg: #7c6c5d;
    
    --view-bg: #fff0e1;
    --view-fg: #7f6e5f;
    
    --headerbar-bg: #7e9dfe;
    --headerbar-fg: #fbf0e8;
    
    --popover-bg: #223249;
    --popover-border: #d2c2c4;
    --popover-menu-bg: #7b98fa;
    --popover-menu-fg: #ffeaec;
    
    --card-bg: rgba(255, 241, 238, 0.4);
    --card-fg: #615144;
    
    --selection-bg: #c8c093;
    --selection-fg: rgba(0, 0, 0, 0.87);
    --error-color: #ff5d62;
}

::selection {
    background-color: var(--selection-bg);
    color: var(--selection-fg);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #f8e0d6 0%, #fff0e1 50%, #e3d2d4 100%);
    color: var(--window-fg);
    display: flex;
    flex-direction: column;
}

/* デスクトップ領域 */
#desktop {
    flex: 1;
    position: relative;
    padding: 24px;
}

/* ドラッグ配置可能なデスクトップアイコン */
.desktop-icon {
    position: absolute;
    width: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: move;
    text-align: center;
    padding: 10px 6px;
    border-radius: 12px;
    transition: background-color 150ms ease, box-shadow 150ms ease;
    user-select: none;
}

.desktop-icon:hover {
    background-color: var(--card-bg);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.desktop-icon.dragging {
    opacity: 0.8;
    z-index: 999;
}

.desktop-icon img {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
    object-fit: contain;
    pointer-events: none;
}

.desktop-icon span {
    color: var(--card-fg);
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
    word-break: break-all;
    pointer-events: none;
}

/* ウィンドウ (GTK window.csd) */
.window {
    position: absolute;
    top: 80px;
    left: 120px;
    width: 720px;
    height: 520px;
    background-color: var(--window-bg);
    color: var(--window-fg);
    border-radius: 12px;
    box-shadow: 8px 8px rgba(65, 57, 58, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(124, 108, 93, 0.15);
    z-index: 100;
}

.window.active {
    display: flex;
}

/* スタートメニュー (アプリ一覧ポップアップ) */
#start-menu-window {
    position: absolute;
    width: 300px;
    height: 380px;
    bottom: 56px;
    left: 12px;
    background-color: var(--popover-bg);
    border: 2px solid var(--popover-border);
    border-radius: 12px;
    box-shadow: 8px 8px rgba(31, 31, 40, 0.4);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1100;
}

#start-menu-window.active {
    display: flex;
}

.start-header {
    background-color: var(--popover-menu-bg);
    color: var(--popover-menu-fg);
    padding: 10px 14px;
    font-size: 14px;
    font-weight: bold;
}

.start-app-list {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.start-app-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #ffeaec;
    cursor: pointer;
    transition: background-color 100ms ease;
}

.start-app-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.start-app-item img {
    width: 24px;
    height: 24px;
}

/* ウィンドウヘッダー */
.window-header {
    height: 38px;
    background-color: var(--headerbar-bg);
    color: var(--headerbar-fg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    cursor: move;
    user-select: none;
}

.window-title {
    font-size: 13px;
    font-weight: bold;
}

.window-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.window-btn {
    width: 16px;
    height: 16px;
    border: none;
    background-color: #fcecee;
    cursor: pointer;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #a59192;
    transition: background-color 75ms ease;
}

.window-btn.close:hover {
    background-color: var(--error-color);
    color: #ffffff;
}

/* ウィンドウ本文 */
.window-body {
    flex: 1;
    position: relative;
    background-color: var(--view-bg);
}

.window-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* タスクバー */
#taskbar {
    height: 48px;
    background-color: rgba(248, 224, 214, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-top: 1px solid rgba(124, 108, 93, 0.2);
    z-index: 1000;
}

.taskbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.start-btn {
    background-color: var(--accent-bg);
    color: var(--accent-fg);
    border: none;
    padding: 6px 16px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 75ms ease;
}

.start-btn:hover {
    background-color: #a79294;
}

/* 右側システムトレイ */
.system-tray {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--window-fg);
    font-size: 12px;
    user-select: none;
}

.tray-icon {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background-color 150ms ease, opacity 100ms ease;
}

.tray-icon:hover {
    background-color: rgba(124, 108, 93, 0.12);
}

/* システムトレイ内のSVGアイコンスタイル */
.tray-icon svg {
    width: 18px;
    height: 18px;
    fill: var(--window-fg); /* UIの柔らかいテキスト色を適用 */
    transition: fill 150ms ease;
}

.tray-icon:hover svg {
    fill: #5a4e43;
}

.tray-icon.hidden {
    display: none;
}

/* バッテリーインジケーター */
.battery-container {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    padding: 4px 6px;
    border-radius: 6px;
}

.battery-container:hover {
    background-color: rgba(124, 108, 93, 0.12);
}

.battery-icon {
    width: 22px;
    height: 11px;
    border: 1.5px solid var(--window-fg);
    border-radius: 3px;
    padding: 1px;
    position: relative;
}

.battery-icon::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 2px;
    width: 2px;
    height: 4px;
    background-color: var(--window-fg);
    border-radius: 0 1px 1px 0;
}

.battery-level {
    height: 100%;
    width: 100%;
    background-color: #68AD99;
    border-radius: 1px;
    transition: width 1s linear, background-color 300ms ease;
}

.battery-level.low {
    background-color: var(--error-color) !important;
}

/* 時計エリア */
.clock-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
    padding: 4px 6px;
    border-radius: 6px;
}

.clock-container:hover {
    background-color: rgba(124, 108, 93, 0.12);
}

.clock-time {
    font-size: 12px;
    font-weight: bold;
}

.clock-date {
    font-size: 10px;
    opacity: 0.8;
}
