/* Main Styles for Chat Bot */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #0f1115;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    padding: 0;
    margin: 0;
    color: #e4e6eb;
    overflow: auto;
    position: static;
    width: 100%;
    font-family: Arial, sans-serif;
}

.chat-container {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    background: #1e1f21;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    background-color: #3a3b3c;
    padding: 15px;
    border-bottom: 1px solid #2f3031;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 15px;
}

.header-left {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.profile-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 40px;
    flex: 1 1 auto;
    min-width: 0;
}

.profile-name {
    font-weight: 600;
    color: #e4e6eb;
    font-size: 14px;
    line-height: 1;
}

.online-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #b0b3b8;
    line-height: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    margin-left: auto;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: radial-gradient( circle at 30% 30%, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.02) 55% ),
                linear-gradient(180deg, #4b4c4f 0%, #2c2d2f 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
}

.icon-btn::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent, #5a5b5f) 0%, rgba(0,0,0,0) 60%);
    opacity: 0.18;
    filter: blur(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: scale(0.96);
}

.icon-btn:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 6px 18px rgba(0,0,0,0.38);
    filter: brightness(1.06);
}

.icon-btn:active {
    transform: translateY(0) scale(0.98);
}

.icon-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.35);
    outline-offset: 2px;
}

.call-btn {
    --accent: #00c853;
    background: linear-gradient(180deg, #19b863 0%, #058f45 100%);
    border-color: rgba(0, 200, 83, 0.35);
}

.video-btn {
    --accent: #ff6d00;
    background: linear-gradient(180deg, #ff8c3a 0%, #ff6d00 100%);
    border-color: rgba(255, 109, 0, 0.35);
}

.call-btn i, .video-btn i {
    font-size: 15px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
}

.icon-btn:hover::before { opacity: 0.28; transform: scale(1); }

/* Mobile view adjustments */
@media (max-width: 480px) {
    .icon-btn {
        width: 30px;
        height: 30px;
    }
    .call-btn i, .video-btn i { font-size: 14px; }
}

/* Mobile view adjustments */
@media (max-width: 480px) {
    .chat-header {
        gap: 10px;
        padding: 12px;
    }

    .profile-pic {
        width: 36px;
        height: 36px;
    }

    .profile-details {
        height: 36px;
    }

    .profile-name {
        font-size: 13px;
    }

    .online-status {
        font-size: 11px;
    }

    .icon-btn {
        width: 28px;
        height: 28px;
    }

    .call-btn i, .video-btn i {
        font-size: 13px;
    }
}

/* Tablet adjustments */
@media (max-width: 768px) {
    .chat-header {
        gap: 12px;
        padding: 14px;
    }
}

.profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 40px;
}

.chat-info h2 {
    font-size: 14px;
    line-height: 1;
    font-weight: 600;
    color: #e4e6eb;
}

.status {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    line-height: 1;
}

.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #2ecc71;
    margin-right: 5px;
    display: inline-block;
    animation: pulse 1.5s infinite;
}

.mobile-number {
    font-weight: 500;
    margin-left: 10px;
}

.status-container {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.online-status {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.4);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 10px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Sticky toolbar inside chat-messages */
.sticky-toolbar {
    position: sticky;
    top: -10px;              /* nudge upward slightly */
    margin-top: -10px;       /* pull up against messages padding */
    z-index: 50;
    display: flex;
    gap: 10px;
    padding: 10px 6px;
    background: linear-gradient(180deg, rgba(30,31,33,0.85) 0%, rgba(30,31,33,0.75) 100%);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid #2f3031;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;     /* bigger buttons */
    border-radius: 20px;    /* more pill-like */
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0,0,0,0.32);
    border: 1px solid rgba(255,255,255,0.08);
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.toolbar-btn:hover {
    transform: translateY(-1px) scale(1.02);
    filter: brightness(1.06);
    box-shadow: 0 6px 18px rgba(0,0,0,0.38);
}

.toolbar-btn:active {
    transform: translateY(0) scale(0.98);
}

.toolbar-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.35);
    outline-offset: 2px;
}

.btn-kellochat {
    background: linear-gradient(135deg, #00a2ff 0%, #0064ff 100%);
    border-color: rgba(0, 100, 255, 0.45);
}
.btn-kellochat:hover {
    filter: brightness(1.08);
}

.btn-kello {
    background: linear-gradient(135deg, #ff8a00 0%, #ff3d00 100%);
    border-color: rgba(255, 61, 0, 0.45);
}
.btn-kello:hover {
    filter: brightness(1.08);
}

/* Small phones */
@media (max-width: 360px) {
    .chat-container { max-width: 100%; border-radius: 0; }
    .chat-header { padding: 10px; }
    .chat-input { padding: 8px; }
}

/* Large phones & phablets */
@media (min-width: 361px) and (max-width: 480px) {
    .chat-container { max-width: 100%; border-radius: 10px; }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .chat-container { max-width: 680px; }
}

/* Custom Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #3a3b3c;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #0084ff;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #0078e7;
}

.message-container {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-end;
}

.bot-container {
    align-items: flex-start;
}

.message-profile-pic {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 8px;
}

.message-profile-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message {
    padding: 10px 15px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    color: #e4e6eb;
    margin-bottom: 10px;
}

.user-message {
    background: #1F5CF8;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.bot-message {
    background-color: #303030;
    color: #e4e6eb;
    border-bottom-left-radius: 5px;
    display: inline-block;
}

.bot-message .message-content img {
    display: block;
    margin: 0 auto;
}

.bot-message a {
    color: #2d88ff;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.bot-message a:hover {
    text-decoration: underline;
    color: #4da3ff;
}

.chat-image, .bot-image {
    max-width: 80%;
    max-height: 200px;
    border-radius: 10px;
    margin: 5px 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-image:hover, .bot-image:hover {
    transform: scale(1.05);
}

/* Image Popup */
.image-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.image-popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-image {
    max-width: 90%;
    max-height: 90%;
    border-radius: 5px;
}

.close-popup {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Chat Input */
.chat-input {
    display: flex;
    padding: 10px 15px;
    background-color: #3a3b3c;
    border-top: 1px solid #4e4f50;
    align-items: flex-end;
    flex-shrink: 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

#messageInput {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    outline: none;
    background-color: #4e4f50;
    color: #e4e6eb;
    font-size: 14px;
    min-height: 40px;
    max-height: 120px;
    overflow-y: auto;
    resize: none;
    line-height: 1.4;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) inset;
}

#sendButton {
    background-color: #0084ff;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    margin-left: 10px;
    outline: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#sendButton:hover {
    background-color: #0063c0;
    transform: scale(1.05);
}

/* Mobile view adjustments */
@media (max-width: 480px) {
    #sendButton {
        width: 45px;
        height: 45px;
        margin-left: 10px;
        margin-right: 5px;
        background-color: #0084ff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    #sendButton i {
        font-size: 18px;
    }
    
    #sendButton:hover {
        transform: scale(1.1);
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    }
    
    .message {
        margin-bottom: 10px;
        max-width: 80%;
    }
    
    .chat-input {
        padding: 10px;
        align-items: center;
    }
    
    #messageInput {
        padding: 10px;
    }
    
    .chat-header {
        gap: 10px;
        padding: 12px;
    }
    
    .profile-details {
        height: 36px;
    }
    
    .profile-pic {
        width: 36px;
        height: 36px;
    }
    
    .profile-name {
        font-size: 13px;
    }
    
    .online-status, .mobile-number {
        font-size: 11px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-container {
        height: auto;
        min-height: 100dvh;
        border-radius: 0;
    }
    
    body {
        padding: 0;
    }
    
    .message {
        max-width: 80%;
    }
}

/* Admin Panel Styles */
.admin-container {
    width: 100%;
    max-width: 1200px;
    color: black;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-header {
    display: flex;
    color: black;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e4e6eb;
}

.admin-nav {
    display: flex;
    background-color: #f0f2f5;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 20px;
}

.admin-nav a {
    padding: 10px 20px;
    text-decoration: none;
    color: #050505;
    font-weight: 500;
}

.admin-nav a.active {
    background-color: #0084ff;
    color: white;
}

.admin-section {
    margin-bottom: 30px;
}

.admin-section h2 {
    margin-bottom: 15px;
    color: #050505;
}

/* Admin Dashboard Stat Cards */
.admin-page .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.admin-page .stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
}
.admin-page .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
}
.admin-page .stat-icon i { font-size: 20px; }
.admin-page .stat-value { font-size: 22px; font-weight: 700; line-height: 1; }
.admin-page .stat-label { font-size: 13px; opacity: 0.9; }
.admin-page .stat-card .more { position: absolute; top: 12px; right: 12px; color: rgba(255,255,255,0.9); }
.admin-page .bg-gradient-blue   { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.admin-page .bg-gradient-green  { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.admin-page .bg-gradient-purple { background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%); }
.admin-page .bg-gradient-orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.admin-page .bg-gradient-pink   { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
.admin-page .bg-gradient-slate  { background: linear-gradient(135deg, #64748b 0%, #475569 100%); }
.admin-page .ratio-card .progress { height: 8px; background: rgba(255,255,255,0.22); }
.admin-page .ratio-card .progress-bar { background: #fff; }
.admin-page .table-enhanced { border-radius: 8px; overflow: hidden; }
.admin-page .table-enhanced .table { margin-bottom: 0; }

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

textarea.form-control {
    min-height: 100px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary {
    background-color: #0084ff;
    color: white;
}

.btn-danger {
    background-color: #ff3b30;
    color: white;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e4e6eb;
}

.table th {
    background-color: #f0f2f5;
    font-weight: 500;
}

.alert {
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Login Form */
.login-container {
    width: 100%;
    max-width: 400px;
    margin: 100px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #0084ff;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .btn {
    width: 100%;
}

/* Admin-only scrolling overrides */
body.admin-page {
  display: block; /* Ensure admin pages stack vertically, not side-by-side */
  height: auto;
  color: black;
  min-height: 100vh;
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.admin-page .admin-container,
.admin-page .login-container {
  height: auto;
  max-height: none;
  overflow: visible;
}

/* Ensure Bootstrap containers can scroll within admin */
.admin-page .container {
  height: auto;
  max-height: none;
  overflow: visible;
}

/* Prevent iOS input focus zoom: keep inputs at least 16px */
.chat-input textarea,
.chat-input input {
  font-size: 16px;
  line-height: 1.4;
}

/* Hint: reduce accidental double-tap zoom on buttons */
#sendButton {
  touch-action: manipulation;
}
/* Typing indicator bubble */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #3a3b3c;
  color: #e4e6eb;
  border-radius: 18px;
  padding: 10px 14px;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b0b3b8;
  animation: blink 1s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2 } 40% { opacity: 1 } }

/* Message time smaller */
.message-time {
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.2;
  opacity: 0.7;
}