/* ============================================
   TASKLINE GROUP STYLING
   Gruppierte Fenster in der Taskbar
   ============================================ */

.taskline-group {
    position: relative;
    width: clamp(48px, 4vw, 72px);
    height: clamp(48px, 4vw, 72px);
    border-radius: clamp(12px, 1vw, 16px);
    background: var(--color-surface-soft);
    backdrop-filter: blur(15px);
    border: 1px solid var(--color-border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: visible;
}

.taskline-group:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
    background: var(--color-surface);
    border-color: var(--color-accent);
}

.taskline-group.pinned {
    border: 2px solid rgba(18, 214, 255, 0.5);
    background: linear-gradient(135deg, rgba(18,214,255,0.15), rgba(18,214,255,0.05));
}

.taskline-group.minimized {
    opacity: 0.7;
}

/* Gruppen-Icon */
.group-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.group-icon svg {
    width: clamp(24px, 2vw, 32px);
    height: clamp(24px, 2vw, 32px);
    stroke: #ffffff;
    transition: all 0.3s ease;
}

.taskline-group:hover .group-icon svg {
    stroke: var(--color-accent);
    transform: scale(1.1);
}

/* Badge mit Fenster-Counter */
.group-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: linear-gradient(135deg, var(--color-accent), #0099cc);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(18, 214, 255, 0.6);
    border: 2px solid var(--color-surface);
}

/* Pin-Indikator */
.pin-indicator {
    position: absolute;
    top: -6px;
    left: -6px;
    font-size: 14px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    animation: pinPulse 2s ease-in-out infinite;
}

@keyframes pinPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============================================
   DROPDOWN (Fensterliste)
   ============================================ */

.group-dropdown {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 280px;
    max-width: 400px;
    background: linear-gradient(145deg, rgba(8, 15, 28, 0.98), rgba(4, 10, 18, 1));
    border: 1px solid var(--color-accent);
    border-radius: 12px;
    backdrop-filter: blur(25px) saturate(180%);
    box-shadow: 
        0 8px 32px rgba(4, 7, 15, 0.6),
        0 0 24px rgba(18, 214, 255, 0.3),
        inset 0 1px rgba(255, 255, 255, 0.1);
    z-index: 10000;
    overflow: hidden;
    animation: dropdownSlideIn 0.2s ease-out;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Dropdown-Pfeil */
.group-dropdown::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid var(--color-accent);
}

/* Header */
.dropdown-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(18,214,255,0.2), rgba(18,214,255,0.08));
    border-bottom: 1px solid var(--color-border-soft);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-accent);
    text-align: center;
}

/* Liste */
.dropdown-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px;
}

/* Scrollbar */
.dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.dropdown-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.dropdown-list::-webkit-scrollbar-thumb {
    background: var(--color-accent);
    border-radius: 3px;
}

/* Dropdown-Item */
.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(18, 214, 255, 0.1);
    border-color: rgba(18, 214, 255, 0.3);
    transform: translateX(4px);
}

.dropdown-item.active {
    background: linear-gradient(135deg, rgba(18,214,255,0.2), rgba(18,214,255,0.08));
    border-color: var(--color-accent);
}

.dropdown-item .window-title {
    flex: 1;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-item.active .window-title {
    color: var(--color-accent);
    font-weight: 600;
}

/* Close-Button */
.window-close-btn {
    width: 24px;
    height: 24px;
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid rgba(255, 59, 48, 0.4);
    border-radius: 6px;
    color: #ff3b30;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.window-close-btn:hover {
    background: rgba(255, 59, 48, 0.4);
    border-color: #ff3b30;
    transform: scale(1.1);
}

/* Footer */
.dropdown-footer {
    padding: 8px;
    border-top: 1px solid var(--color-border-soft);
    background: rgba(0, 0, 0, 0.2);
}

.close-all-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.2), rgba(255, 59, 48, 0.1));
    border: 1px solid rgba(255, 59, 48, 0.4);
    border-radius: 8px;
    color: #ff3b30;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-all-btn:hover {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.3), rgba(255, 59, 48, 0.2));
    border-color: #ff3b30;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
}

/* ============================================
   KONTEXTMENÜ
   ============================================ */

.group-context-menu {
    position: fixed;
    min-width: 200px;
    background: var(--color-taskbar);
    border: 1px solid var(--color-border-soft, rgba(255, 255, 255, 0.1));
    border-radius: 10px;
    backdrop-filter: blur(25px) saturate(180%);
    box-shadow: 
        0 8px 32px rgba(4, 7, 15, 0.6),
        0 0 20px rgba(18, 214, 255, 0.3);
    z-index: 10001;
    padding: 6px;
    animation: contextMenuFadeIn 0.15s ease-out;
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Context Menu Header */
.context-menu-header {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-accent);
    border-bottom: 1px solid var(--color-border-soft);
    margin-bottom: 4px;
}

/* Context Menu Window List */
.context-menu-windows {
    padding: 4px 0;
    margin-bottom: 4px;
}

.context-menu-window-item {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.context-menu-window-item:hover {
    background: rgba(18, 214, 255, 0.1);
}

.context-menu-window-item.active {
    background: rgba(18, 214, 255, 0.15);
    border-left: 3px solid var(--color-accent);
    padding-left: 11px;
}

.context-menu-window-item .window-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.window-close-btn-small {
    width: 20px;
    height: 20px;
    padding: 0;
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 4px;
    color: #ff3b30;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.window-close-btn-small:hover {
    background: rgba(255, 59, 48, 0.3);
    border-color: #ff3b30;
    transform: scale(1.1);
}

/* Context Menu Separator */
.context-menu-separator {
    height: 1px;
    background: var(--color-border-soft);
    margin: 6px 0;
}

.context-menu-item {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu-item:hover {
    background: rgba(18, 214, 255, 0.15);
    color: var(--color-accent);
    transform: translateX(4px);
}

.context-menu-item.danger {
    color: #ff3b30;
}

.context-menu-item.danger:hover {
    background: rgba(255, 59, 48, 0.15);
}

/* ============================================
   RESPONSIVE ANPASSUNGEN
   ============================================ */

@media (max-width: 768px) {
    .group-dropdown {
        min-width: 240px;
        max-width: calc(100vw - 40px);
    }

    .dropdown-item .window-title {
        font-size: 12px;
    }
}
