﻿/*!
  Datei: cpKey.css
  Beschreibung: Styles für das cp-key-function Widget (cpKey v3.0)
  Abhängigkeit: WebComponentsIcons.ttf
*/

/* ------------------------------------------------------------
   Fonts & Root Variablen
------------------------------------------------------------ */
@font-face {
    font-family: 'WebComponentsIcons';
    src: url('../../Kendo/fonts/glyphs/WebComponentsIcons.ttf') format('truetype');
}

:root {
    --cp-radius: 8px;
    --cp-height: 40px;
    --cp-width-left: 40px;
    --cp-width-right: 40px;
}

/* ------------------------------------------------------------
   cpKey – Grundstruktur
------------------------------------------------------------ */
.cp-key-function {
    position: relative;
    display: inline-block;
    overflow: hidden;
    cursor: pointer;
    touch-action: manipulation;
    border-radius: var(--cp-radius, 18px);
    user-select: none;
}

    .cp-key-function:hover,
    .cp-key-function:focus {
        text-decoration: none !important; /* Unterstreichung ausschalten */
        filter: brightness(1.2); /* 80% Helligkeit → wirkt dunkler */
    }

.cp-key-bg {
    display: flex;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
    background: linear-gradient(135deg, lightblue, darkblue);
}

.cp-key-left, .cp-key, .cp-key-right {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--cp-height, 40px);
}

/* linke Zone: standardmäßig leicht breiter wegen Radius-Einlauf */
.cp-key-left {
    width: calc(var(--cp-width-left, 24px) + var(--cp-radius, 8px) / 2);
    padding-left: calc(var(--cp-radius, 8px) / 2);
    align-items: flex-start; /* Content oben ansetzen (Standard) */
    justify-content: center;
    border-top-left-radius: inherit;
    border-bottom-left-radius: inherit;
    background: transparent;
    color: white;
    font-size: 1.4em;
}

.cp-key {
    flex-grow: 1;
    text-align: center;
    padding: 0 8px;
    font-weight: bold;
    font-size: 1.5em;
    color: white;
}


.cp-key-right {
    width: calc(var(--cp-width-right, 24px) + var(--cp-radius, 8px) / 2);
    padding-right: calc(var(--cp-radius, 8px) / 2);
    align-items: center;
    justify-content: center;
    border-top-right-radius: inherit;
    border-bottom-right-radius: inherit;
    background: transparent;
    color: white;
    font-size: 1.4em;
}

/* Codepoint-Icons (Kendo Glyphs) */
.cp-key-codepoint {
    font-family: WebComponentsIcons;
    font-size: 1.5em;
    line-height: 1;
    pointer-events: none;
    align-self: center;
    margin-top: 1px;
}

/* Bilder im Key (Default-Verhalten für NICHT Avatare) */
.cp-key-image {
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    display: block;
    opacity: 0.9;
    pointer-events: none;
    margin-top: 7px;
    margin-bottom: auto; /* drückt das Bild nach oben */
    padding-bottom: 4px; /* Mindestabstand nach unten */
}

/* Label */
.cp-key-label {
    font-size: 1em;
    line-height: 1.2em;
    font-weight: bold;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: left;
}

/* Badge */
.cp-key-badge {
    background-color: red;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.75em;
    margin-left: 4px;
    white-space: nowrap;
}

/* Glossy Overlay */
.cp-key-glossy-overlay {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 3;
    background: linear-gradient(to bottom, rgba(255,255,255,0.30) 0%, rgba(255,255,255,0.10) 40%, rgba(255,255,255,0.05) 60%, rgba(0,0,0,0.05) 100%), radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.05) 50%, rgba(0,0,0,0.10) 100%);
    background-blend-mode: screen;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
}

.cp-key-function.selected .cp-key-glossy-overlay {
    opacity: 1;
    box-shadow: 0 0 8px 4px rgba(255,255,128,0.4);
}



.cp-key-glossy-overlay:not(.selected) {
    opacity: 0.2;
    box-shadow: none;
}

/* ------------------------------------------------------------
   Scroll-Wrapper / Key-Gruppen
------------------------------------------------------------ */
.cp-key-scroll-wrapper {
    position: relative;
    width: 100%;
}

.cp-key-group-scrollable {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: pan-x;
    padding-bottom: 4px;
    scrollbar-width: none; /* Firefox */
}

    .cp-key-group-scrollable::-webkit-scrollbar {
        display: none;
    }
/* Chrome/Safari */

.cp-key-group-horizontal {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
}

    .cp-key-group-horizontal .cp-key-function {
        flex-shrink: 0;
        min-width: unset;
    }

/* Desktop: Scrollbar nur bei Hover */
@media (pointer: fine) {
    .cp-key-group-scrollable {
        overflow-x: hidden;
    }

        .cp-key-group-scrollable:hover {
            overflow-x: auto;
        }
}



/* Pfeilzonen (optional) */
.cp-key-scroll-left,
.cp-key-scroll-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    background: rgba(255,255,255,0.7);
    color: #333;
    cursor: pointer;
    z-index: 5;
    user-select: none;
    transition: opacity 0.2s ease;
}

.cp-key-scroll-left {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.9), rgba(255,255,255,0));
}

.cp-key-scroll-right {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.9), rgba(255,255,255,0));
}

/* ------------------------------------------------------------
   AVATAR – runder Profilbild-Button (füllt Kreis vollständig)
   Anwendung: <a class="cp-key-function cp-key-avatar"> ... </a>
------------------------------------------------------------ */

/* Avatar: linke Zone exakt quadratisch + ohne Innenabstand */
.cp-key-avatar {
    --cp-width-left: var(--cp-height); /* Kreisfläche = genauso breit wie hoch */
}

    .cp-key-avatar .cp-key-left {
        width: var(--cp-width-left) !important;
        padding-left: 0 !important;
        overflow: hidden !important;
        border-radius: 50% !important;
        position: relative !important; /* <- für absolut positioniertes Bild */
        align-items: stretch !important; /* falls doch Flex greift */
        justify-content: center !important;
    }

        /* Bild F U L L  B L E E D in der Kreisfläche */
        .cp-key-avatar .cp-key-left > img.cp-key-image {
            position: absolute !important;
            inset: 0 !important;
            width: 100% !important;
            height: 100% !important;
            max-width: none !important;
            max-height: none !important;
            margin: 0 !important;
            padding: 0 !important;
            border-radius: 50% !important;
            object-fit: cover !important;
            object-position: top center !important;
            display: block !important;
            opacity: 1 !important;
            pointer-events: auto !important; /* wichtig für Hover */
            transition: transform .15s ease-in-out, box-shadow .15s;
        }

            .cp-key-avatar .cp-key-left > img.cp-key-image:hover {
                border-color: darkorange;
                border-width: 4px;
            }
        /* -------- Hover-Effekt für Avatar -------- */
        .cp-key-avatar .cp-key-left:hover::after {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: 50%;
            box-shadow: 0 0 0 3px darkorange; /* oranger Ring */
            pointer-events: none; /* blockiert nichts */
        }

        .cp-key-avatar .cp-key-left:hover > img.cp-key-image {
            transform: scale(1.02);
        }


    /* Optional: Avatar ohne Label/Right-Zone (nur runder Button) */
    .cp-key-avatar .cp-key,
    .cp-key-avatar .cp-key-right {
        display: none !important;
    }
