/*
 * Zusätzliche CSS-Regeln für die Desktop‑Simulation.
 * Tailwind liefert den Großteil des Layouts; hier können zusätzliche Anpassungen
 * vorgenommen werden oder fehlende Assets neutralisiert werden.
 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    background: url("./img/wallpaper.png") no-repeat center center fixed !important;
    background-size: cover !important;
    margin: 0;
    padding: 0;
}

:root {
    --window-shadow: 0 22px 45px rgba(15, 23, 42, 0.18);
    --window-shadow-hover: 0 28px 58px rgba(15, 23, 42, 0.25);
    --window-border: rgba(15, 23, 42, 0.12);
    /* Increased desktop icon mask size for better visual weight */
    --desktop-icon-size: 88px;
}

.dark {
    --window-shadow: 0 26px 52px rgba(15, 23, 42, 0.45);
    --window-shadow-hover: 0 34px 68px rgba(15, 23, 42, 0.55);
    --window-border: rgba(148, 163, 184, 0.2);
}

body>header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4000 !important;
}

.desktop-area {
    position: fixed;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 36px 120px;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    pointer-events: auto;
    gap: 32px;
}

.desktop-icon-column {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 22px;
    pointer-events: auto;
}

.desktop-icon-button {
    /* compact container so mask appears larger relative to label */
    width: 100px;
    max-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border: none;
    background: transparent;
    padding: 8px 6px 10px;
    border-radius: 14px;
    cursor: pointer;
    color: #f8fafc;
    text-shadow: 0 2px 6px rgba(15, 23, 42, 0.55);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

html.dark .desktop-icon-button {
    color: #e2e8f0;
    text-shadow: 0 2px 6px rgba(7, 11, 19, 0.75);
}

.desktop-icon-button:hover {
    background: rgba(255, 255, 255, 0.22);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.22);
}

html.dark .desktop-icon-button:hover {
    background: rgba(148, 163, 184, 0.22);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.55);
}

.desktop-icon-button:focus-visible {
    outline: 2px solid rgba(96, 165, 250, 0.9);
    outline-offset: 3px;
}

.desktop-icon-button[data-selected="true"] {
    background: rgba(59, 130, 246, 0.35);
    box-shadow: 0 24px 42px rgba(37, 99, 235, 0.32);
}

html.dark .desktop-icon-button[data-selected="true"] {
    background: rgba(37, 99, 235, 0.45);
    box-shadow: 0 26px 48px rgba(15, 23, 42, 0.55);
}

.desktop-icon-graphic {
    width: var(--desktop-icon-size);
    height: var(--desktop-icon-size);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
}

/* Emoji sizing: make emoji fill a larger portion of the mask */
.desktop-icon-graphic {
    /* font-size used for text-emoji fallback inside the mask */
    font-size: calc(var(--desktop-icon-size) * 0.55);
    line-height: 1;
}

html.dark .desktop-icon-graphic {
    background: rgba(30, 41, 59, 0.55);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65);
}

.desktop-icon-graphic img {
    /* Fill the entire mask and use the container's shape as clipping/mask */
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
    filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.22));
    /* ensure the image follows the container rounding */
    border-radius: inherit;
}

/* Rubberband selection visuals */
.desktop-rubberband {
    mix-blend-mode: normal;
    border-radius: 4px;
}

/* Temporary highlight when an icon is inside the rubberband */
.desktop-icon-button.rubber-selected {
    box-shadow: 0 28px 48px rgba(37, 99, 235, 0.18);
}

.desktop-icon-label {
    display: inline-block;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    padding: 2px 8px 4px;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-shadow: inherit;
}

.desktop-icon-button[data-selected="true"] .desktop-icon-label {
    background: rgba(37, 99, 235, 0.85);
    color: #ffffff;
}

html.dark .desktop-icon-button[data-selected="true"] .desktop-icon-label {
    background: rgba(59, 130, 246, 0.85);
    color: #f8fafc;
}

.menubar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 34px;
    padding: 0 16px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    color: #0f172a;
    -webkit-backdrop-filter: saturate(140%) blur(18px);
    backdrop-filter: saturate(140%) blur(18px);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

html.dark .menubar {
    background: rgba(17, 25, 40, 0.75);
    border-bottom: 1px solid rgba(94, 106, 135, 0.35);
    color: #edeff3;
    box-shadow: 0 1px 0 rgba(8, 10, 20, 0.7);
}

.menubar-left,
.menubar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menubar-links {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
}

.menubar-trigger {
    position: relative;
    display: flex;
    align-items: center;
}

.menubar-logo,
.menubar-item,
.menubar-status-icon {
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.menubar-logo {
    padding: 4px 6px;
}

.menubar-logo svg,
.menubar-status-icon svg {
    display: block;
}

.menubar-item {
    padding-inline: 6px;
}

.menubar-item:hover,
.menubar-status-icon:hover,
.menubar-logo:hover,
.menubar-item:focus-visible,
.menubar-status-icon:focus-visible,
.menubar-logo:focus-visible {
    background: rgba(15, 23, 42, 0.08);
    outline: none;
}

html.dark .menubar-item:hover,
html.dark .menubar-status-icon:hover,
html.dark .menubar-logo:hover,
html.dark .menubar-item:focus-visible,
html.dark .menubar-status-icon:focus-visible,
html.dark .menubar-logo:focus-visible {
    background: rgba(148, 163, 184, 0.18);
}

.menubar-app {
    font-weight: 600;
}

.menubar-right {
    margin-left: auto;
    gap: 14px;
    display: flex;
    align-items: center;
}

.menubar-status-cluster {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.menubar-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px;
}

.menubar-battery svg {
    width: 18px;
    height: 18px;
}

.menubar-status-icon-svg,
.system-toggle-icon,
.system-slider-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.menubar-battery-label {
    font-variant-numeric: tabular-nums;
}

.menubar-clock {
    min-width: 64px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    list-style: none;
    margin: 0;
    min-width: 190px;
    padding: 6px 0;
    background: rgba(245, 246, 248, 0.96);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
    -webkit-backdrop-filter: saturate(140%) blur(16px);
    backdrop-filter: saturate(140%) blur(16px);
    color: inherit;
}

.menu-dropdown.menu-right {
    left: auto;
    right: 0;
}

html.dark .menu-dropdown {
    background: rgba(25, 34, 52, 0.95);
    border: 1px solid rgba(99, 112, 144, 0.45);
    box-shadow: 0 22px 42px rgba(0, 0, 0, 0.55);
}

.menu-dropdown li {
    margin: 0;
    padding: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    width: 100%;
    padding: 6px 18px;
    color: inherit;
    font-size: 13px;
    line-height: 1.3;
    transition: background-color 0.15s ease, color 0.15s ease;
    background: transparent;
    border: none;
    text-align: left;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.menu-item:hover,
.menu-item:focus-visible {
    background: rgba(59, 130, 246, 0.14);
    outline: none;
}

html.dark .menu-item:hover,
html.dark .menu-item:focus-visible {
    background: rgba(148, 163, 184, 0.22);
}

.menu-item-label {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.menu-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.menu-item-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.menu-item-shortcut {
    flex: 0 0 auto;
    font-size: 12px;
    opacity: 0.7;
}

.system-dropdown {
    min-width: 260px;
    padding: 10px 0;
}

.system-section {
    padding: 6px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.system-section+.system-section {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    margin-top: 4px;
    padding-top: 12px;
}

html.dark .system-section+.system-section {
    border-top-color: rgba(71, 85, 105, 0.35);
}

.system-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
    color: inherit;
    opacity: 0.72;
}

.system-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.system-toggle {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    padding: 10px;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.system-toggle.is-active {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.32);
}

.system-toggle:hover,
.system-toggle:focus-visible {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.28);
    outline: none;
}

html.dark .system-toggle {
    background: rgba(71, 85, 105, 0.32);
}

html.dark .system-toggle:hover,
html.dark .system-toggle:focus-visible {
    background: rgba(148, 163, 184, 0.26);
    border-color: rgba(148, 163, 184, 0.35);
}

html.dark .system-toggle.is-active {
    background: rgba(96, 165, 250, 0.28);
    border-color: rgba(96, 165, 250, 0.4);
}

.system-toggle-label {
    font-size: 13px;
    font-weight: 600;
}

.system-toggle-status {
    font-size: 11px;
    opacity: 0.7;
}

.system-slider-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    opacity: 0.85;
}

.system-slider-value {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    opacity: 0.6;
}

.system-slider {
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.4);
    outline: none;
    margin-bottom: 6px;
}

html.dark .system-slider {
    background: rgba(71, 85, 105, 0.65);
}

.system-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.system-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #2563eb;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.system-slider::-moz-range-track {
    height: 4px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.4);
    border: none;
}

html.dark .system-slider::-moz-range-track {
    background: rgba(71, 85, 105, 0.65);
}

.system-state-pill {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    background: rgba(59, 130, 246, 0.14);
    color: inherit;
}

html.dark .system-state-pill {
    background: rgba(147, 197, 253, 0.18);
}

.system-network-indicator {
    font-size: 10px;
    opacity: 0.65;
}

.system-menu-item {
    justify-content: space-between;
}

.system-menu-item.is-active {
    background: rgba(59, 130, 246, 0.12);
}

html.dark .system-menu-item.is-active {
    background: rgba(96, 165, 250, 0.18);
}

.system-menu-item[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
}

.menu-item[disabled],
.menu-item[aria-disabled="true"] {
    opacity: 0.45;
    cursor: default;
}

.menu-item[disabled]:hover,
.menu-item[aria-disabled="true"]:hover {
    background: transparent;
}

.menu-item-link {
    text-decoration: none;
}

.menu-separator {
    height: 1px;
    margin: 4px 12px;
    background: rgba(148, 163, 184, 0.4);
}

html.dark .menu-separator {
    background: rgba(71, 85, 105, 0.7);
}

#apple-menu-dropdown,
#program-dropdown {
    z-index: 2147483647 !important;
}

#snap-preview-overlay {
    position: fixed;
    pointer-events: none;
    background: rgba(96, 165, 250, 0.14);
    border: 1px dashed rgba(96, 165, 250, 0.45);
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    -webkit-backdrop-filter: saturate(140%) brightness(1.05) blur(4px);
    backdrop-filter: saturate(140%) brightness(1.05) blur(4px);
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 2500;
}

html.dark #snap-preview-overlay {
    background: rgba(147, 197, 253, 0.22);
    border-color: rgba(191, 219, 254, 0.55);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
}

#snap-preview-overlay[data-side="left"] {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#snap-preview-overlay[data-side="right"] {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

#snap-preview-overlay.snap-preview-visible {
    opacity: 1;
}

/* Stelle sicher, dass iframes und Modale sauber gestylt sind */
.modal iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/*
 * Modal containers cover den gesamten Bildschirm (inset-0). Ohne Eingriff fangen sie alle Klicks
 * ab und verhindern, dass man ein dahinterliegendes Fenster mit der Maus erreicht. Durch
 * pointer-events:none auf dem Container und pointer-events:auto auf dem eigentlichen
 * Fensterelement (autopointer) werden Klicks korrekt an hinterliegende Fenster weitergereicht.
 */
.modal {
    pointer-events: none;
}

.modal .autopointer {
    pointer-events: auto;
    box-sizing: border-box;
    max-width: none;
    border: 1px solid var(--window-border);
    box-shadow: var(--window-shadow);
    transition: box-shadow 0.25s ease;
}

.modal .autopointer>* {
    min-width: 0;
}

.modal .autopointer:focus-within,
.modal .autopointer:hover {
    box-shadow: var(--window-shadow-hover);
}

.no-select {
    -ms-user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

/* --- macOS‑ähnliches Dock --- */
#dock {
    pointer-events: auto;
}

#dock .dock-tray {
    width: max-content;
    border-radius: 18px;
    background: rgba(245, 245, 247, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.12) inset;
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    backdrop-filter: saturate(160%) blur(18px);
}

html.dark #dock .dock-tray {
    background: rgba(17, 24, 39, 0.45);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(255, 255, 255, 0.06) inset;
}

#dock .dock-item {
    margin: 0 6px;
}

#dock .dock-icon {
    width: 64px;
    height: 64px;
    transition: transform 0.18s ease, filter 0.18s ease;
    will-change: transform;
}

@media (min-width: 768px) {
    #dock .dock-icon {
        width: 72px;
        height: 72px;
    }
}

#dock .dock-icon {
    transform-origin: bottom center;
}

#dock .dock-tooltip {
    background: rgba(17, 24, 39, 0.85);
    z-index: 400;
    transition: transform 0.18s ease, opacity 0.12s ease;
    will-change: transform;
}

html.dark #dock .dock-tooltip {
    background: rgba(0, 0, 0, 0.7);
}

/* ============================================================================
   Finder Styles
   ============================================================================ */

/* Toolbar */
.finder-toolbar-btn {
    padding: 0.375rem;
    border-radius: 0.375rem;
    color: #6b7280;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.finder-toolbar-btn:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.dark .finder-toolbar-btn:hover {
    background-color: #374151;
    color: #f9fafb;
}

/* Breadcrumbs */
.finder-breadcrumb-item {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
}

.finder-breadcrumb-item:hover {
    background-color: #f3f4f6;
}

.dark .finder-breadcrumb-item:hover {
    background-color: #374151;
}

.finder-breadcrumb-separator {
    color: #9ca3af;
    padding: 0 0.25rem;
}

/* Sidebar */
.finder-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.875rem;
    color: #374151;
    transition: background-color 0.15s ease;
}

.finder-sidebar-item:hover {
    background-color: #f3f4f6;
}

.finder-sidebar-item.finder-sidebar-active {
    background-color: #e5e7eb;
    font-weight: 500;
}

.dark .finder-sidebar-item {
    color: #d1d5db;
}

.dark .finder-sidebar-item:hover {
    background-color: #374151;
}

.dark .finder-sidebar-item.finder-sidebar-active {
    background-color: #4b5563;
}

.finder-sidebar-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

/* List View */
.finder-list-table {
    width: 100%;
    border-collapse: collapse;
}

.finder-list-table thead th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.finder-list-table thead th:hover {
    background-color: #f9fafb;
}

.dark .finder-list-table thead th {
    color: #9ca3af;
    border-bottom-color: #374151;
}

.dark .finder-list-table thead th:hover {
    background-color: #1f2937;
}

.finder-list-item {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.finder-list-item:hover {
    background-color: #f9fafb;
}

.dark .finder-list-item:hover {
    background-color: #1f2937;
}

.finder-list-item td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: #111827;
    border-bottom: 1px solid #f3f4f6;
}

.dark .finder-list-item td {
    color: #f9fafb;
    border-bottom-color: #1f2937;
}

.finder-item-icon {
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

/* Grid View */
.finder-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    padding: 0.5rem;
}

.finder-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.finder-grid-item:hover {
    background-color: #f3f4f6;
}

.dark .finder-grid-item:hover {
    background-color: #374151;
}

.finder-grid-icon {
    font-size: 3rem;
}

.finder-grid-name {
    font-size: 0.875rem;
    text-align: center;
    word-break: break-word;
    color: #111827;
}

.dark .finder-grid-name {
    color: #f9fafb;
}

/* Empty State */
.finder-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}