/*
 * 1. Top Banner
 */

/* --- MODIFY FOR ADMIN BAR --- */
.tcp-banner {
    position: relative;
    z-index: 9999;
}
body.admin-bar .tcp-banner {
    top: 32px;
}
@media screen and (max-width: 782px) {
    body.admin-bar .tcp-banner {
        top: 46px;
    }
}
/* --- END MODIFY FOR ADMIN BAR --- */

.tcp-banner {
    background-color: #bd2b2b; 
    color: #ffffff;
    padding: 12px 20px;
    width: 100%;
    box-sizing: border-box;
    
    /* --- CSS ANIMATED FALLING SNOW --- */
    background-image: 
        radial-gradient(circle, rgba(255,255,255,0.7) 1px, transparent 1px),
        radial-gradient(circle, rgba(255,255,255,0.5) 2px, transparent 2px),
        radial-gradient(circle, rgba(255,255,255,0.3) 3px, transparent 3px);
    
    /* Using prime numbers for size makes the pattern look random */
    background-size: 
        53px 53px,
        97px 97px,
        149px 149px;
    
    /* Using new offsets for a less uniform start */
    background-position: 
        0 0, 
        31px 47px,
        73px 19px;
    
    background-repeat: repeat;
    animation: 
        tcp-snow-fall 20s linear infinite,
        tcp-snow-fall 15s linear infinite,
        tcp-snow-fall 10s linear infinite;
    /* --- END NEW BACKGROUND --- */
}

.tcp-banner-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.tcp-banner-text {
    font-size: 1.1em;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* --- BUTTON STYLE (BANNER) --- */
.tcp-banner-button {
    position: relative;
    overflow: hidden;
    z-index: 1;
    background-color: #f9f9f9; 
    color: #bd2b2b;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    animation: tcp-pulse-shadow 3s ease-in-out infinite;
}

.tcp-banner-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0,0,0,0.25);
    animation-play-state: paused;
}
/* --- END BUTTON STYLE --- */


/*
 * 2. Floating Widget
 */
.tcp-floating-widget {
    position: fixed;
    bottom: 85px;
    left: 20px;
    z-index: 99998;
    display: flex;
    align-items: center;
}

/* 2a. The Circle Opener */
.tcp-widget-opener {
    position: relative;
    overflow: hidden;
    background-color: #bd2b2b;
    color: #ffffff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 10;
    transition: border-radius 0.3s ease-in-out 0.4s, 
                transform 0.2s ease, 
                box-shadow 0.2s ease;
}

.tcp-widget-opener:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.tcp-widget-opener svg {
    position: relative;
    top: -1px; 

    width: 36px;      
    height: 36px;
    fill: #FFFFFF;    
}

/* 2b. The Expanded Content */
.tcp-widget-expanded {
    display: flex;
    align-items: stretch;
    background-color: #bd2b2b;
    border-radius: 0 30px 30px 0;
    height: 60px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-width 0.4s ease-in-out 0s,
                opacity 0.1s linear 0.4s,
                visibility 0s linear 0.4s;
}

.tcp-widget-content {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 10px 0 20px;
    white-space: nowrap; 
}

.tcp-widget-text {
    font-size: 1em;
    color: #fff;
    transition: color 0.2s ease-out;
}

/* --- Content Link Wrapper --- */
.tcp-widget-content-link {
    text-decoration: none;
    color: #fff;
    display: flex;
    align-items: center;
    flex-grow: 1; /* Allows the link to fill the available space */
    transition: background-color 0.2s ease-out;
    border-radius: 0;
}

.tcp-widget-content-link:hover {
    background-color: #a72626; 
}

/* .tcp-widget-content-link:hover .tcp-widget-text { */
    /* color: #00BDDE; */
/* } */

/* The Closer Button */
.tcp-widget-closer {
    background-color: transparent;
    color: #fff;
    height: 60px;
    width: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 0 30px 30px 0;
    transition: background-color 0.2s ease;
    transition: color 0.2s ease-out;

    position: relative;
}

.tcp-widget-closer:hover {
    background-color: #a72626;
    /* color: #00BDDE; */
}

/*
 * This creates the new vertical separator line
 * inside the "closer" button.
 */
.tcp-widget-closer::before {
    content: '';
    position: absolute;
    left: 0; /* Positionerar den på vänstra kanten */
    top: 50%; /* Centrerar den vertikalt */
    transform: translateY(-50%); /* Finjusterar centreringen */

    /* "lite tjockare" */
    width: 2px; 

    /* "inte gå hela vägen upp och nedtill" */
    height: 32px; /* Sätter en fast höjd (justera 36px om du vill) */
    
    background-color: #fff;
    border-radius: 5px; /* Ger linjen mjuka kanter */
}

/* The 'is-expanded' State */
.tcp-floating-widget.is-expanded .tcp-widget-opener {
    border-radius: 50% 0 0 50%;
    transition: border-radius 0.3s ease-in-out 0s,
                transform 0.2s ease, 
                box-shadow 0.2s ease;
}

.tcp-floating-widget.is-expanded .tcp-widget-expanded {
    max-width: 450px; 
    opacity: 1;
    visibility: visible;
    transition: max-width 0.4s ease-in-out 0.3s,
                opacity 0.1s linear 0.3s,
                visibility 0s linear 0.3s;
}


/* --- BANNER & CIRCLE SHINE EFFECT --- */
.tcp-banner-button::before,
.tcp-widget-opener::before {
    content: '';
    position: absolute;
    top: 0;
    width: 60px;
    height: 100%;
    z-index: 2;
    background: linear-gradient(
        100deg, 
        rgba(255, 255, 255, 0) 10%, 
        rgba(255, 255, 255, 0.4) 50%, 
        rgba(255, 255, 255, 0) 90%
    );
    transform: skewX(-20deg);
    
    /* Set default state to match animation's 0% frame */
    left: -80px;
    opacity: 0.2;
    
    animation: tcp-shine 4s ease-in-out infinite;
    animation-delay: 2.5s;
}

@keyframes tcp-shine {
    0% {
        left: -80px;
        opacity: 0.2;
    }
    30% {
        left: 120%;
        opacity: 1;
    }
    100% {
        left: 120%;
        opacity: 1;
    }
}
/* --- END SHINE EFFECT --- */


/* --- BANNER BUTTON PULSE EFFECT --- */
@keyframes tcp-pulse-shadow {
    0% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    }
    100% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    }
}
/* --- END PULSE EFFECT --- */


/* --- FALLING SNOW KEYFRAMES --- */
@keyframes tcp-snow-fall {
    from {
        /* Start at the new random positions */
        background-position: 0 0, 31px 47px, 73px 19px;
    }
    to {
        /* * End at different Y-offsets to enhance parallax.
         * (Start Y + Travel Distance)
         * Layer 1 (10s): 0 + 100px = 100px
         * Layer 2 (15s): 47px + 150px = 197px
         * Layer 3 (20s): 19px + 200px = 219px
         */
        background-position: 0 100px, 31px 197px, 73px 219px;
    }
}
/* --- END NEW KEYFRAMES --- */

/*
 * Mobile Responsiveness (Simple Fit)
 */
@media screen and (max-width: 550px) {

    .tcp-floating-widget {
        left: 15px;
        /* 1. Säkerställ att hela widgeten (inkl. marginaler) 
              inte är bredare än skärmen */
        max-width: calc(100vw - 30px); /* 15px marginal på varje sida */
    }

    .tcp-floating-widget.is-expanded .tcp-widget-expanded {
        /* 2. Justera den expanderade delens max-bredd för att passa
              den nya totala max-bredden (minus öppnaren). */
        /* (Widget max-width) - (Opener width) = calc(100vw - 30px) - 60px */
        max-width: calc(100vw - 90px);
    }

    .tcp-widget-text {
        /* 3. Gör texten mindre så den ryms på en rad */
        font-size: 0.85em; 
    }
    
    /* 4. Minska lite på marginaler och mellanrum för att hjälpa texten att passa */
    .tcp-widget-content {
        gap: 10px; /* Minskad från 15px */
        padding-left: 15px; /* Minskad från 20px */
        padding-right: 5px; /* Minskad från 10px */
    }
}
