/* Text Box Toggle Button Styles */

/* Toggle button styling - inside text box */
.textbox-toggle-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    z-index: 102;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-family: Arial, sans-serif;
}

.textbox-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

.textbox-toggle-btn:active {
    transform: scale(0.95);
}

/* When text box is hidden, show toggle button in corner */
.textbox-toggle-btn.standalone {
    position: fixed;
    top: 10%;
    left: 2%;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 14px;
}

/* Hidden state for text box */
#right.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* Animation for showing text box */
#right.showing {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* Compact mode styling */
#right.compact {
    width: 240px;
    max-width: 25%;
    max-height: 50%;
    padding: 12px;
}

#right.compact .title {
    font-size: 16px;
    margin-bottom: 6px;
}

#right.compact .desc {
    font-size: 12px;
    line-height: 18px;
    height: calc(100% - 50px);
}

/* Toggle button icon rotation */
.textbox-toggle-btn.rotated {
    transform: rotate(180deg);
}

.textbox-toggle-btn.rotated:hover {
    transform: rotate(180deg) scale(1.1);
}

/* Mobile responsive adjustments */
@media only screen and (max-width: 992px) {
    .textbox-toggle-btn {
        top: 6px;
        right: 6px;
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
    
    .textbox-toggle-btn.standalone {
        position: fixed;
        bottom: 20px;
        left: 20px;
        top: auto;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    #right.compact {
        width: auto;
        max-width: 90%;
        max-height: 35%;
        padding: 10px;
        padding-top: 30px;
    }
    
    #right.compact .title {
        font-size: 15px;
    }
    
    #right.compact .desc {
        font-size: 11px;
        line-height: 16px;
    }
}

/* Enhanced visual effects */
.textbox-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        rgba(255, 255, 255, 0.05) 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.textbox-toggle-btn:hover::before {
    opacity: 1;
}

/* Pulse animation for initial attention */
.textbox-toggle-btn.pulse {
    animation: pulse-toggle 2s infinite;
}

@keyframes pulse-toggle {
    0% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(255, 255, 255, 0.1);
    }
    100% {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
}

/* Smooth transitions for all states */
#right, .textbox-toggle-btn {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Focus states for accessibility */
.textbox-toggle-btn:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

/* Theme-aware styling */
.textbox-toggle-btn.light-theme {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-color: rgba(0, 0, 0, 0.1);
}

.textbox-toggle-btn.light-theme:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.2);
}