/* Live support chat styles. Moved out of templates/support_popup.html so
   browsers can cache them instead of downloading ~17 KB inside every page.
   Loaded at the same spot the inline <style> used to be. */
        /* ========== YOUR EXISTING STYLES ========== */
        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        .chat-toggle {
            display: flex;
            position: fixed;
            top: 15px;
            left: 15px;
            background: linear-gradient(135deg, #7c3aed, #c026d3);
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 5px 15px rgba(0,0,0,0.2);
            z-index: 2501;
            border: 2px solid rgba(255,255,255,0.2);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            font-size: 1.1rem;
            padding: 0;
            margin: 0;
            box-sizing: border-box;
            overflow: visible;
            line-height: 1;
        }

        .chat-toggle:hover {
            transform: scale(1.1);
            box-shadow: 0 8px 25px rgba(0,0,0,0.25);
        }
        
        /* Special Support / Emergency Support Button */
        .special-support-toggle {
            position: fixed;
            bottom: 30px;
            left: 115px;
            background: linear-gradient(135deg, #f6d365, #fda085);
            color: white;
            width: 70px;
            height: 70px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 5px 25px rgba(253, 160, 133, 0.4);
            z-index: 9998;
            border: 3px solid rgba(255,255,255,0.2);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            font-size: 1.8rem;
        }

        .emergency-support-toggle {
            position: fixed;
            top: 165px;
            left: 15px;
            background: linear-gradient(135deg, #ff416c, #ff4b2b);
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 5px 15px rgba(255, 65, 108, 0.4);
            z-index: 2501;
            border: 2px solid rgba(255,255,255,0.2);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            font-size: 1.1rem;
            animation: pulse-emergency 2s infinite;
            text-decoration: none;
            padding: 0;
            margin: 0;
            box-sizing: border-box;
            overflow: visible;
            line-height: 1;
        }
        
        @media (max-width: 767.98px) {
            .chat-toggle, .emergency-support-toggle {
                width: 36px !important;
                height: 36px !important;
                font-size: 1rem !important;
            }
            .chat-toggle { right: 10px; left: auto; top: 196px; }
            .emergency-support-toggle { right: 10px; left: auto; top: 242px; }
        }
        
        .emergency-support-toggle:hover {
            transform: scale(1.1) translateY(-5px);
            box-shadow: 0 10px 30px rgba(255, 65, 108, 0.6);
            background: linear-gradient(135deg, #ff4b2b, #ff416c);
        }
        
        @keyframes pulse-emergency {
            0% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0.7); }
            70% { box-shadow: 0 0 0 15px rgba(255, 65, 108, 0); }
            100% { box-shadow: 0 0 0 0 rgba(255, 65, 108, 0); }
        }

        /* Emergency Modal Styles */
        .emergency-modal {
            display: none;
            position: fixed;
            z-index: 10000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0,0,0,0.7);
            backdrop-filter: blur(5px);
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.3s ease;
        }
        
        .emergency-modal-content {
            background: linear-gradient(135deg, #0f172a, #1e293b);
            color: white;
            padding: 30px;
            border-radius: 20px;
            max-width: 450px;
            width: 90%;
            text-align: center;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            border: 2px solid #ff416c;
            position: relative;
        }
        
        .emergency-modal-content .emergency-title {
            color: #ff416c;
            margin-bottom: 20px;
            font-weight: 700;
            /* the size and spacing it had as an <h3> (pva-theme.css) */
            font-size: clamp(1.15rem, 1rem + .8vw, 1.5rem);
            letter-spacing: -.02em;
            line-height: 1.25;
        }
        
        .emergency-modal-content p {
            font-size: 1.1rem;
            line-height: 1.6;
            margin-bottom: 25px;
        }
        
        .emergency-btn-telegram {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            background: #0088cc;
            color: white;
            padding: 12px 25px;
            border-radius: 30px;
            text-decoration: none;
            font-weight: 700;
            font-size: 1.1rem;
            transition: all 0.3s;
        }
        
        .emergency-btn-telegram:hover {
            background: #00a2f5;
            transform: translateY(-3px);
            box-shadow: 0 10px 20px rgba(0, 136, 204, 0.4);
            color: white;
        }
        
        .emergency-close {
            position: absolute;
            top: 15px;
            right: 20px;
            font-size: 1.5rem;
            cursor: pointer;
            color: #718096;
            transition: color 0.2s;
        }
        
        .emergency-close:hover {
            color: white;
        }
        
        .chat-toggle:hover {
            transform: scale(1.1) translateY(-5px);
            box-shadow: 0 10px 30px rgba(0,0,0,0.4);
            background: linear-gradient(135deg, #c026d3, #7c3aed);
        }
        
        #unreadBadge {
            position: absolute;
            top: -5px;
            right: -5px;
            background: #ff4757;
            color: white;
            border-radius: 50%;
            padding: 0.4rem 0.8rem;
            font-size: 0.9rem;
            font-weight: bold;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
            display: none;
        }
        
        .chat-popup {
            position: fixed;
            bottom: 120px;
            left: 30px;
            width: 400px;
            background: linear-gradient(135deg, #1e293b, #334155);
            border-radius: 15px;
            box-shadow: 0 15px 50px rgba(0,0,0,0.4);
            display: none;
            z-index: 9999;
            overflow: hidden;
            border: 2px solid rgba(255,255,255,0.1);
        }
        
        body[data-theme="dark"] .chat-popup {
            background: linear-gradient(135deg, #0f172a, #1e293b);
        }
        
        .chat-header {
            background: linear-gradient(135deg, #7c3aed, #c026d3);
            color: white;
            padding: 18px 20px;
            border-radius: 15px 15px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 2px solid rgba(255,255,255,0.1);
        }
        
        .chat-header .chat-title {
            margin: 0;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 10px;
            /* the size and spacing it had as an <h4> (pva-theme.css); the colour
               now comes from .chat-header (white) instead of the global heading colour */
            font-size: 1.15rem;
            letter-spacing: -.02em;
            line-height: 1.25;
        }
        
        .chat-header .chat-title i {
            font-size: 1.2rem;
        }
        
        .chat-status {
            font-size: 0.9rem;
            opacity: 0.9;
            display: flex;
            align-items: center;
            gap: 5px;
        }
        
        .status-indicator {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            display: inline-block;
        }
        
        .status-online {
            background: #48bb78;
            box-shadow: 0 0 10px #48bb78;
        }
        
        .status-offline {
            background: #fc8181;
        }
        
        .close-chat {
            background: rgba(255,255,255,0.1);
            border: none;
            color: white;
            width: 35px;
            height: 35px;
            border-radius: 50%;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .close-chat:hover {
            background: rgba(255,255,255,0.2);
            transform: rotate(90deg);
        }

        /* 🔔 Telegram reminder style */
        .telegram-reminder {
            background: rgba(0, 136, 204, 0.2);
            border-left: 4px solid #0088cc;
            padding: 10px 15px;
            margin: 0 15px 10px 15px;
            border-radius: 8px;
            font-size: 0.9rem;
            display: none;  /* hidden by default */
            align-items: center;
            gap: 10px;
            color: #e6f0fa;
        }
        .telegram-reminder i {
            font-size: 1.2rem;
            color: #0088cc;
        }
        .telegram-reminder a {
            color: #99c6ff;
            text-decoration: underline;
            font-weight: 500;
        }
        .telegram-reminder a:hover {
            color: white;
        }
        
        .chat-body {
            height: 350px;
            overflow-y: auto;
            padding: 20px;
            background: rgba(0,0,0,0.2);
        }
        
        .quick-replies {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            padding: 10px 15px;
            background: rgba(0,0,0,0.3);
            border-top: 1px solid rgba(255,255,255,0.1);
        }
        
        .quick-reply-btn {
            padding: 8px 12px;
            background: rgba(255,255,255,0.1);
            border: 1px solid rgba(255,255,255,0.2);
            border-radius: 20px;
            color: white;
            font-size: 0.8rem;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }
        
        .quick-reply-btn:hover {
            background: rgba(124, 58, 237, 0.5);
            border-color: #7c3aed;
        }
        
        .message {
            margin: 12px 0;
            padding: 12px 16px;
            border-radius: 15px;
            max-width: 85%;
            word-wrap: break-word;
            position: relative;
            animation: fadeIn 0.3s ease;
            box-shadow: 0 3px 10px rgba(0,0,0,0.1);
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .visitor {
            background: linear-gradient(135deg, #7c3aed, #c026d3);
            color: white;
            margin-left: auto;
            margin-right: 0;
            border-bottom-right-radius: 5px;
        }
        
        .agent {
            background: linear-gradient(135deg, #38a169, #2f855a);
            color: white;
            margin-right: auto;
            margin-left: 0;
            border-bottom-left-radius: 5px;
        }

        .admin-reply {
            background: linear-gradient(135deg, #b7791f, #d69e2e);
            color: white;
            margin-right: auto;
            margin-left: 0;
            border-bottom-left-radius: 5px;
        }

        .admin-badge {
            display: inline-block;
            background: rgba(255,255,255,0.25);
            border-radius: 8px;
            padding: 1px 7px;
            font-size: 0.72rem;
            font-weight: 700;
            margin-left: 5px;
            vertical-align: middle;
            letter-spacing: 0.5px;
        }
        
        .message-sender {
            font-size: 0.8rem;
            font-weight: bold;
            margin-bottom: 4px;
            opacity: 0.9;
        }
        
        .message-image {
            margin: 8px 0;
            max-width: 100%;
        }
        
        .message-image img {
            max-width: 100%;
            max-height: 200px;
            border-radius: 8px;
            cursor: pointer;
            transition: transform 0.2s;
        }
        
        .message-image img:hover {
            transform: scale(1.02);
        }
        
        .message-time {
            font-size: 0.7rem;
            opacity: 0.7;
            text-align: right;
            margin-top: 5px;
        }
        
        .block-warning {
            background: rgba(255, 71, 87, 0.2);
            border: 1px solid #ff4757;
            border-radius: 10px;
            padding: 15px;
            margin: 15px;
            text-align: center;
            color: #ff8a8a;
        }
        
        .block-warning i {
            font-size: 2rem;
            margin-bottom: 10px;
        }
        
        .chat-input {
            display: flex;
            padding: 15px;
            background: rgba(0,0,0,0.3);
            border-top: 1px solid rgba(255,255,255,0.1);
            gap: 10px;
            align-items: center;
        }
        
        .chat-input input {
            flex: 1;
            min-width: 0;
            padding: 12px 15px;
            border: none;
            border-radius: 10px;
            background: rgba(255,255,255,0.1);
            color: white;
            /* >= 16px so iOS Safari does not zoom the page in on focus. */
            font-size: 16px;
            transition: all 0.2s;
        }
        
        .chat-input input:focus {
            outline: none;
            background: rgba(255,255,255,0.15);
            box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.5);
        }
        
        .chat-input input::placeholder {
            color: rgba(255,255,255,0.6);
        }
        
        .image-upload-label {
            flex-shrink: 0;
            background: rgba(255,255,255,0.1);
            color: white;
            padding: 8px 12px;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
        }
        
        .image-upload-label:hover {
            background: rgba(124, 58, 237, 0.5);
        }
        
        .chat-input button {
            flex-shrink: 0;
            padding: 12px 25px;
            background: linear-gradient(135deg, #48bb78, #38a169);
            color: white;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.2s;
            white-space: nowrap;
        }
        
        .chat-input button:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(56, 161, 105, 0.4);
            background: linear-gradient(135deg, #38a169, #2f855a);
        }
        
        .chat-input button:disabled {
            background: #718096;
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }
        
        .welcome-message {
            text-align: center;
            padding: 30px 20px;
            color: rgba(255,255,255,0.8);
        }
        
        .welcome-message i {
            font-size: 3rem;
            margin-bottom: 15px;
            opacity: 0.7;
        }
        
        .welcome-message small {
            display: block;
            margin-top: 15px;
            color: #aaa;
        }
        
        .start-chat-btn {
            margin-top:15px; 
            padding:10px 20px; 
            background:linear-gradient(135deg, #7c3aed, #c026d3); 
            color:white; 
            border:none; 
            border-radius:10px; 
            cursor:pointer;
            font-size: 1rem;
        }
        
        @media (max-width: 767.98px) {
            .chat-popup {
                width: calc(100vw - 40px);
                left: 20px;
                bottom: 100px;
                max-height: 500px;
            }
            .chat-body {
                height: 300px;
            }
            .chat-input {
                padding: 10px;
                gap: 6px;
            }
            .chat-input button {
                padding: 12px 14px;
            }
        }
        
        .chat-body::-webkit-scrollbar {
            width: 8px;
        }
        .chat-body::-webkit-scrollbar-track {
            background: rgba(255,255,255,0.05);
            border-radius: 4px;
        }
        .chat-body::-webkit-scrollbar-thumb {
            background: linear-gradient(135deg, #7c3aed, #c026d3);
            border-radius: 4px;
        }
        
        .typing-indicator {
            display: none;
            padding: 10px 15px;
            background: rgba(255,255,255,0.1);
            border-radius: 15px;
            margin: 10px 0;
            max-width: 60px;
        }
        .typing-indicator span {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #7c3aed;
            margin: 0 2px;
            animation: typing 1.4s infinite ease-in-out;
        }
        .typing-indicator span:nth-child(1) { animation-delay: 0s; }
        .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
        .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
        @keyframes typing {
            0%, 60%, 100% { transform: translateY(0); }
            30% { transform: translateY(-5px); }
        }
