/* GLOBAL STYLES FOR YRREJ TV */

:root {
    --chat-bg: rgba(15, 15, 15, 0.85);
    --chat-accent: #3b82f6;
    --chat-text: #e2e8f0;
    --chat-petey: #1e293b;
    --chat-user: #2563eb;
    --chat-orange: #f97316;
}

/* --- SPEED DIAL FAB --- */
.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10001; /* Above the slider header but below slider if full height? Actually slider is 10000. Let's keep it 10001. */
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 12px;
}

.fab-main {
    width: 56px;
    height: 56px;
    background: #eab308; /* yellow-500 */
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.5);
    color: black;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
}

.fab-container:hover .fab-main {
    transform: scale(1.1);
}

.fab-main i {
    transition: transform 0.3s;
}

.fab-container:hover .fab-main i {
    transform: rotate(45deg);
}

.fab-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fab-container:hover .fab-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.fab-action {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.2s;
    position: relative;
    border: none;
}

.fab-action:hover {
    transform: scale(1.1);
}

.fab-action i {
    font-size: 18px;
}

/* Action Tooltips */
.fab-action::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    border: 1px solid rgba(255,255,255,0.1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fab-action:hover::after {
    opacity: 1;
}

/* Action Colors */
.fab-blue { background: #2563eb; }
.fab-green { background: #16a34a; }
.fab-purple { background: #9333ea; }
.fab-orange { background: #f97316; }

/* --- GLOBAL CHAT SLIDER --- */
#global-chat-slider {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80vh; /* Fallback */
    height: min(800px, 90dvh);
    max-height: 100dvh;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: var(--chat-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    display: flex;
    flex-direction: column;
    color: var(--chat-text);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    font-family: 'Inter', sans-serif;
    touch-action: none; /* Prevent browser scrolling while dragging the handle */
    overflow: hidden; /* Ensure content doesn't leak out */
}

#global-chat-slider.open {
    transform: translateY(0);
}

#global-chat-slider.dragging {
    transition: none !important;
}

.chat-handle-container {
    width: 100%;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.chat-drag-handle {
    width: 40px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.chat-header {
    padding: 0 20px 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    position: relative;
    width: 44px;
    height: 44px;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--chat-accent);
}

.chat-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--chat-bg);
}

.chat-title-group h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.chat-title-group p {
    margin: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Message Styles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: messageFadeIn 0.3s ease-out forwards;
}

@keyframes messageFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.petey { align-self: flex-start; }
.message.user { align-self: flex-end; }

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.petey .message-bubble {
    background: var(--chat-petey);
    color: #f1f5f9;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user .message-bubble {
    background: var(--chat-user);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 4px;
    padding: 0 4px;
}

.user .message-time { text-align: right; }

.chat-typing {
    padding: 0 20px 10px 20px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.chat-input-area {
    padding: 15px 20px 30px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.input-wrapper {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 8px 8px 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: border-color 0.3s;
}

.input-wrapper:focus-within { border-color: var(--chat-accent); }

.input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    padding: 8px 0;
    resize: none;
    outline: none;
    max-height: 100px;
    font-family: inherit;
}

#chat-send-btn {
    width: 36px;
    height: 36px;
    background: var(--chat-accent);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

#chat-send-btn:hover { background: #2563eb; transform: scale(1.05); }

/* Desktop Slider */
@media (min-width: 768px) {
    #global-chat-slider {
        right: 30px;
        left: auto;
        width: 400px;
        height: 600px;
        border-radius: 20px;
        bottom: 30px;
        transform: translateY(calc(100% + 50px));
    }
    #global-chat-slider.open { transform: translateY(0); }
    .chat-handle-container { height: 20px; }
}
