@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;700&display=swap');

/* =============================================
   BASE WIDGET
   ============================================= */
.cw-sticky-widget {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    box-sizing: border-box;
    font-family: 'Space Grotesk', sans-serif;
    width: 100px;
    height: 300px;
    background: #E6E6E6;
    border-radius: 20px 0 0 20px;
    overflow: hidden;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Initial entrance — only on first load */
.cw-sticky-widget.is-initial[data-state="collapsed"] {
    animation: cw-pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.cw-sticky-widget[data-state="collapsed"] {
    cursor: pointer;
}

/* Smooth width expand */
.cw-sticky-widget[data-state="expanding"],
.cw-sticky-widget[data-state="expanded"] {
    width: 330px;
}

/* Collapsing: fast shrink back */
.cw-sticky-widget[data-state="collapsing"] {
    width: 100px;
    transition: width 0.4s 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   COLLAPSED STATE
   ============================================= */
.cw-collapsed {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100%;
    padding: 20px 10px;
    box-sizing: border-box;
    position: absolute;
    top: 0;
    right: 0;
    transition: opacity 0.3s ease;
}

.cw-sticky-widget[data-state="expanding"] .cw-collapsed,
.cw-sticky-widget[data-state="expanded"] .cw-collapsed {
    opacity: 0;
    pointer-events: none;
}

/* Collapsing: fade collapsed content back in after width shrinks */
.cw-sticky-widget[data-state="collapsing"] .cw-collapsed {
    opacity: 0;
    transition: opacity 0.35s 0.45s ease;
}

/* Vertical label */
.cw-label {
    writing-mode: sideways-lr;
    text-orientation: mixed;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    font-weight: 700;
    font-size: 20px;
    color: #000;
    line-height: 1.2;
    user-select: none;
}

.cw-label-line {
    white-space: nowrap;
}

/* Collapsed icons - stacked diagonally */
.cw-icons--collapsed {
    margin-top: 35px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* =============================================
   EXPANDED STATE
   ============================================= */
.cw-expanded {
    display: flex;
    flex-direction: column;
    width: 330px;
    height: 100%;
    padding: 29px 17px 0 25px;
    box-sizing: border-box;
    position: absolute;
    top: 0;
    right: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s 0.2s ease;
}

.cw-sticky-widget[data-state="expanding"] .cw-expanded,
.cw-sticky-widget[data-state="expanded"] .cw-expanded {
    opacity: 1;
    pointer-events: auto;
}

/* Collapsing: fade out expanded content quickly */
.cw-sticky-widget[data-state="collapsing"] .cw-expanded {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Header row */
.cw-expanded-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s 0.35s ease, transform 0.4s 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cw-sticky-widget[data-state="expanding"] .cw-expanded-header,
.cw-sticky-widget[data-state="expanded"] .cw-expanded-header {
    opacity: 1;
    transform: translateY(0);
}

.cw-sticky-widget[data-state="collapsing"] .cw-expanded-header {
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.cw-expanded-title {
    margin: 0;
    font-weight: 700;
    font-size: 20px !important;
    color: #000;
    line-height: 1.3;
}

/* Close button */
.cw-close-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cw-close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cw-close-btn svg {
    width: 14px;
    height: 14px;
}

/* Subtitle */
.cw-expanded-subtitle {
    margin: 12px 0 0 0;
    font-weight: 400;
    text-align: left;
    font-size: 12px;
    color: #000;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s 0.5s ease, transform 0.4s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cw-sticky-widget[data-state="expanding"] .cw-expanded-subtitle,
.cw-sticky-widget[data-state="expanded"] .cw-expanded-subtitle {
    opacity: 1;
    transform: translateY(0);
}

.cw-sticky-widget[data-state="collapsing"] .cw-expanded-subtitle {
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Expanded icons - side by side */
.cw-icons--expanded {
    position: absolute;
    bottom: 71px;
    left: 28px;
    right: 28px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 104px;
    align-items: flex-end;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s 0.6s ease, transform 0.4s 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cw-sticky-widget[data-state="expanding"] .cw-icons--expanded,
.cw-sticky-widget[data-state="expanded"] .cw-icons--expanded {
    opacity: 1;
    transform: translateY(0);
}

.cw-sticky-widget[data-state="collapsing"] .cw-icons--expanded {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* =============================================
   TILE WRAPPER (icon → tile morph)
   ============================================= */
.cw-tile-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
}

.cw-tile-wrapper .cw-tile-origin {
    position: relative;
    z-index: 2;
    transition: opacity 0.35s ease, transform 0.35s ease, border-radius 0.35s ease;
}

/* Tile (hidden initially, revealed via JS) */
.cw-tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 144px;
    height: 158px;
    padding: 15px;
    box-sizing: border-box;
    border-radius: 16px;
    text-decoration: none;
    position: absolute;
    bottom: -55px;
    left: -40px;
    pointer-events: none;
    z-index: 1;
    box-shadow: 4px 4px 4px 0px #00000040;

    /* Start from icon center: clip to circle shape */
    clip-path: circle(24px at 64px calc(100% - 79px + 24px));
    opacity: 0;
    transition: clip-path 0.55s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
}

.cw-tile--chat {
    background: #55728A;
    color: #fff;
}

.cw-tile--phone {
    background: #ffffff;
    color: #000;
}

.cw-tile--phone .cw-tile-small-text,
.cw-tile--phone .cw-tile-big-text {
    color: #000;
}

.cw-tile-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    opacity: 0;
    transition: opacity 0.3s 0.35s ease;
}

.cw-tile-small-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    text-align: left;
    font-size: 8px;
    line-height: 1.3;
    color: #fff;
}

.cw-tile-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cw-tile-bottom {
    display: flex;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.3s 0.4s ease;
}

.cw-tile-big-text {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 24px;
    line-height: 23px;
    text-align: left;
    color: #fff;
}

/* Tile revealed state (toggled via JS class) */
.cw-tile-wrapper.is-tile-open .cw-tile-origin {
    opacity: 0;
    transform: scale(0);
    pointer-events: none;
}

.cw-tile-wrapper.is-tile-open .cw-tile {
    clip-path: circle(150% at 64px calc(100% - 79px + 24px));
    opacity: 1;
    pointer-events: auto;
}

.cw-tile-wrapper.is-tile-open .cw-tile-top,
.cw-tile-wrapper.is-tile-open .cw-tile-bottom {
    opacity: 1;
}

.cw-tile:hover {
    filter: brightness(1.08);
}

/* =============================================
   ICONS (shared)
   ============================================= */
.cw-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    box-shadow: 4px 4px 4px 0px #00000040;
    text-decoration: none;
    position: relative;
    transition: transform 0.2s ease;
}

.cw-icon:hover {
    transform: scale(1.08);
}

.cw-icon svg {
    width: 24px;
    height: 24px;
}

/* Chat icon */
.cw-icon--chat {
    background: #55728A;
    z-index: 1;
}

/* Phone icon */
.cw-icon--phone {
    background: #ffffff;
    z-index: 2;
}

/* Collapsed: phone overlaps chat diagonally */
.cw-icons--collapsed .cw-icon--phone {
    margin-top: -25px;
    margin-left: 25px;
}

/* =============================================
   KEYFRAME ANIMATIONS
   ============================================= */

/* Initial pop-in */
@keyframes cw-pop-in {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.6) translateX(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(-50%) scale(1) translateX(0);
    }
}
