/* ============================================
   CAPITAL PARTNERS HR CHATBOT - STYLES
   ============================================ */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

/* === MAIN CONTAINER === */
.chat-container {
    width: 100%;
    height: 100vh;
    background: white;
    display: flex;
    flex-direction: column;
}

/* === HEADER === */
.chat-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 15px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    height: 100px;
}

.header-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.chat-title-ar {
    font-size: 18px;
    font-weight: 600;
    opacity: 0.95;
    font-family: 'Arial', sans-serif;
}

.logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* === HAMBURGER MENU === */
.hamburger-menu {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* === MESSAGES AREA === */
.chat-messages {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
    background: #fafafa;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

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

/* === MESSAGE BUBBLES === */
.message {
    margin-bottom: 25px;
    display: flex;
    align-items: flex-start;
    gap: 0;
    animation: fadeIn 0.4s ease;
}

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

.message.user {
    flex-direction: row-reverse;
}

.message.system {
    justify-content: center;
}

/* Message Icons - HIDDEN FOR CHATGPT STYLE */
.message-icon {
    display: none !important;
}

/* Message Content */
.message-content {
    max-width: 85%;
    padding: 16px 20px;
    border-radius: 18px;
    line-height: 1.7;
    word-wrap: break-word;
}

.message.user .message-content {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-bottom-right-radius: 20px;
    box-shadow: 0 2px 8px rgba(42, 82, 152, 0.3);
}

.message.assistant .message-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 16px 0 !important;
    border-radius: 0 !important;
    max-width: 100%;
    color: #333;
}

.message.system .message-content {
    background: linear-gradient(135deg, #e8f4f8 0%, #f0f8fc 100%);
    color: #1e3c72;
    border-radius: 12px;
    max-width: 85%;
    padding: 24px 28px;
    box-shadow: 0 2px 12px rgba(42, 82, 152, 0.1);
    text-align: center;
}

/* === IMPROVED MESSAGE FORMATTING === */

/* Section headers within messages */
.section-header {
    font-size: 16px;
    font-weight: 600;
    color: #1e3c72;
    margin-top: 16px;
    margin-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 6px;
}

.section-header:first-child {
    margin-top: 0;
}

/* Improved bullet lists */
ul.bullet-list {
    list-style: none;
    padding-left: 0;
    margin: 12px 0 16px 0;
}

.bullet-list li.bullet-item {
    position: relative;
    padding-left: 28px;
    margin-bottom: 10px;
    line-height: 1.7;
    color: #333;
}

.bullet-list li.bullet-item::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #2a5298;
    font-weight: bold;
    font-size: 16px;
}

/* Sub-items (nested bullets) */
.bullet-list li.bullet-item.sub-item {
    padding-left: 48px;
    margin-top: 6px;
    margin-bottom: 8px;
    font-size: 15px;
    color: #555;
}

.bullet-list li.bullet-item.sub-item::before {
    content: "◦";
    left: 28px;
    font-size: 14px;
    color: #666;
}

/* RTL Support for Arabic */
ul.bullet-list.rtl {
    direction: rtl;
    text-align: right;
}

.bullet-list.rtl li.bullet-item {
    padding-left: 0;
    padding-right: 28px;
}

.bullet-list.rtl li.bullet-item::before {
    left: auto;
    right: 8px;
}

.bullet-list.rtl li.bullet-item.sub-item {
    padding-right: 48px;
    padding-left: 0;
}

.bullet-list.rtl li.bullet-item.sub-item::before {
    right: 28px;
    left: auto;
}

/* Strong text within messages */
.message-content strong {
    color: #1e3c72;
    font-weight: 600;
    background-color: rgba(42, 82, 152, 0.05);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Source references */
.source-reference {
    font-size: 13px;
    color: #666;
    font-style: italic;
    display: block;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

/* Improved content sections */
.content-section {
    line-height: 1.7;
}

.content-section p {
    margin-bottom: 14px;
    color: #333;
}

.content-section p:last-child {
    margin-bottom: 0;
}

/* Better spacing for lists after paragraphs */
.content-section p + ul.bullet-list {
    margin-top: 10px;
}

/* Links in messages */
.message-content a {
    color: #2a5298;
    text-decoration: none;
    border-bottom: 1px solid #2a5298;
}

.message-content a:hover {
    color: #1e3c72;
    border-bottom-color: #1e3c72;
}

/* Emphasis text */
.message-content em {
    color: #666;
    font-style: italic;
}

/* === DISCLAIMER BOX === */
.disclaimer-box {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border-left: 4px solid #ffa726;
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-size: 14px;
    color: #6d4c41;
    line-height: 1.6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.disclaimer-box br:last-child {
    display: none;
}

/* === INPUT AREA === */
.chat-input-container {
    padding: 20px 40px;
    background: white;
    border-top: 2px solid #e8e8e8;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
}

.chat-input {
    flex: 1;
    padding: 16px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-input:focus {
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.send-button {
    padding: 16px 32px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(42, 82, 152, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(42, 82, 152, 0.4);
}

.send-button:active:not(:disabled) {
    transform: translateY(0);
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* === LOADING INDICATOR === */
.loading {
    display: none;
    padding: 15px 20px;
    background: white;
    border-radius: 18px;
    border: 1px solid #e0e0e0;
    max-width: 65%;
}

.loading.active {
    display: block;
}

.loading-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: #2a5298;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* === POLICY SEARCH ANIMATION === */
.policy-search-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px;
    margin: 10px 0;
    animation: fadeInAnimation 0.3s ease-in;
}

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

/* Document Stack Container */
.document-stack {
    position: relative;
    height: 96px;
    width: 128px;
}

/* Document Layer */
.document-layer {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    border: 2px solid #1e3c72;
    background: white;
    opacity: 0.9;
}

.document-layer-0 {
    z-index: 3;
    transform: translateY(0px) translateX(0px);
    animation: documentScan 2s ease-in-out infinite;
}

.document-layer-1 {
    z-index: 2;
    transform: translateY(4px) translateX(2px);
    animation: documentScan 2s ease-in-out infinite 0.3s;
}

.document-layer-2 {
    z-index: 1;
    transform: translateY(8px) translateX(4px);
    animation: documentScan 2s ease-in-out infinite 0.6s;
}

/* Document Lines Inside */
.document-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
}

.doc-line {
    height: 6px;
    border-radius: 9999px;
    background-color: #1e3c72;
    opacity: 0.3;
}

.doc-line-1 { width: 75%; }
.doc-line-2 { width: 100%; }
.doc-line-3 { width: 83%; }
.doc-line-4 { width: 66%; }

/* Scanning Beam */
.scan-beam {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background: linear-gradient(to right, transparent, #1e3c72, transparent);
}

.scan-beam-0 {
    animation: scanBeam 2s ease-in-out infinite;
}

.scan-beam-1 {
    animation: scanBeam 2s ease-in-out infinite 0.3s;
}

.scan-beam-2 {
    animation: scanBeam 2s ease-in-out infinite 0.6s;
}

/* Search Icon */
.search-icon-badge {
    position: absolute;
    right: -8px;
    top: -8px;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #1e3c72;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.search-icon-badge svg {
    width: 16px;
    height: 16px;
    animation: pulseAnimation 1.5s ease-in-out infinite;
}

/* Status Text */
.search-status-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-status-text span {
    font-size: 14px;
    font-weight: 500;
    color: #1e3c72;
}

.loading-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #1e3c72;
}

.loading-dot-0 {
    animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dot-1 {
    animation: dotPulse 1.4s ease-in-out infinite 0.2s;
}

.loading-dot-2 {
    animation: dotPulse 1.4s ease-in-out infinite 0.4s;
}

/* Policy Search Animations */
@keyframes documentScan {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
    }
}

@keyframes scanBeam {
    0% {
        top: 0%;
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

@keyframes dotPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

@keyframes pulseAnimation {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* === VOICE RECORDING === */
/* Voice Controls Container */
.voice-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Delete Recording Button */
.delete-recording-btn {
    padding: 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    width: 52px;
    height: 52px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.delete-recording-btn:hover {
    background: #c82333;
    transform: scale(1.05);
}

.voice-button {
    padding: 16px;
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    position: relative;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-button:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.voice-button.recording {
    background: #dc3545;
    animation: pulseRecording 2s infinite;
}

@keyframes pulseRecording {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.recording-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dc3545;
    display: none;
}

.voice-button.recording .recording-indicator {
    display: block;
}

.recording-status {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: #dc3545;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
}

.recording-status.active {
    display: flex;
}

.recording-dot {
    font-size: 10px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Chatbot Icon Container */
.chatbot-icon-container {
    display: flex;
    align-items: center;
    padding-right: 20px;
}

.chatbot-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* ========== VOICE MESSAGE STYLING ========== */
.message.user .message-content.voice-content {
    background: rgba(42, 82, 152, 0.1) !important;
    border: 1px solid rgba(42, 82, 152, 0.3) !important;
    padding: 12px 16px !important;
    border-radius: 16px !important;
    min-width: 300px;
    max-width: 350px;
}

.voice-audio-player {
    width: 100% !important;
    height: 36px;
    outline: none;
    display: block;
    border-radius: 8px;
}

/* Style the audio player controls */
.voice-audio-player::-webkit-media-controls-panel {
    background-color: transparent;
}

.voice-audio-player::-webkit-media-controls-play-button,
.voice-audio-player::-webkit-media-controls-current-time-display,
.voice-audio-player::-webkit-media-controls-time-remaining-display {
    color: #1e3c72;
    filter: brightness(0.8);
}

.voice-audio-player::-webkit-media-controls-timeline {
    background-color: #d1d5db;
    border-radius: 25px;
    margin: 0 6px;
}

.voice-audio-player::-webkit-media-controls-volume-slider {
    display: none;
}

/* Dark mode for voice player */
body.dark-mode .message.user .message-content.voice-content {
    background: rgba(42, 82, 152, 0.2) !important;
    border-color: rgba(42, 82, 152, 0.4) !important;
}

body.dark-mode .voice-audio-player::-webkit-media-controls-play-button,
body.dark-mode .voice-audio-player::-webkit-media-controls-current-time-display,
body.dark-mode .voice-audio-player::-webkit-media-controls-time-remaining-display {
    color: #f3f4f6;
    filter: brightness(1.2);
}

body.dark-mode .voice-audio-player::-webkit-media-controls-timeline {
    background-color: #4b5563;
}

/* === DARK MODE STYLES === */

/* Header Right Container */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Theme Toggle Button */
.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Logout Button */
.logout-button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-button:hover {
    background: rgba(220, 53, 69, 0.3);
    border-color: rgba(220, 53, 69, 0.5);
    transform: scale(1.05);
}

/* Dark Mode Variables */
body.dark-mode {
    background: #1a1a1a;
}

body.dark-mode .chat-container {
    background: #2d2d2d;
}

body.dark-mode .chat-messages {
    background: #1a1a1a;
}

body.dark-mode .message.assistant .message-content {
    color: #e0e0e0;
}

body.dark-mode .message.system .message-content {
    background: linear-gradient(135deg, #2a4a6a 0%, #1e3a5a 100%);
    color: #e0e0e0;
}

body.dark-mode .chat-input-container {
    background: #2d2d2d;
    border-top-color: #404040;
}

body.dark-mode .chat-input {
    background: #1a1a1a;
    color: #e0e0e0;
    border-color: #404040;
}

body.dark-mode .chat-input:focus {
    border-color: #4a7bc8;
}

body.dark-mode .loading {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .section-header {
    color: #6ba3d8;
    border-bottom-color: #404040;
}

body.dark-mode .message-content strong {
    color: #6ba3d8;
    background-color: rgba(107, 163, 216, 0.1);
}

body.dark-mode .content-section p {
    color: #d0d0d0;
}

body.dark-mode .bullet-list li.bullet-item {
    color: #d0d0d0;
}

body.dark-mode .bullet-list li.bullet-item.sub-item {
    color: #c0c0c0;
}

body.dark-mode .bullet-list li.bullet-item::before {
    color: #6ba3d8;
}

body.dark-mode .disclaimer-box {
    background: linear-gradient(135deg, #3a3a2a 0%, #4a4a3a 100%);
    border-left-color: #d4a574;
    color: #e0d0c0;
}

body.dark-mode .source-reference {
    color: #a0a0a0;
    border-top-color: #404040;
}

body.dark-mode .message-content a {
    color: #6ba3d8;
    border-bottom-color: #6ba3d8;
}

body.dark-mode .message-content a:hover {
    color: #8bc0e8;
    border-bottom-color: #8bc0e8;
}

body.dark-mode .message-content em {
    color: #b0b0b0;
}

/* Dark mode for policy search animation */
body.dark-mode .document-layer {
    background: #2d2d2d;
    border-color: #6ba3d8;
}

body.dark-mode .doc-line {
    background-color: #6ba3d8;
}

body.dark-mode .search-icon-badge {
    background-color: #6ba3d8;
}

body.dark-mode .search-status-text span {
    color: #6ba3d8;
}

body.dark-mode .loading-dot {
    background-color: #6ba3d8;
}

/* ============================================
   HISTORY SIDEBAR STYLES
   ============================================ */

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s;
}

.sidebar-toggle:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* History Sidebar */
.history-sidebar {
    position: fixed;
    left: -350px;
    top: 0;
    width: 350px;
    height: 100dvh;
    height: 100vh; 
    background: white;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Modern browsers support */
@supports (height: 100dvh) {
    .history-sidebar {
        height: 100dvh;
    }
}

.history-sidebar.open {
    left: 0;
}

/* Sidebar Top Section */
.sidebar-top {
    padding: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.new-chat-btn-minimal {
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #333;
    transition: all 0.2s;
}

.new-chat-btn-minimal:hover {
    background: rgba(0, 0, 0, 0.05);
}

.new-chat-btn-minimal i {
    font-size: 16px;
}

/* Sidebar Bottom Section */
.sidebar-bottom {
    padding: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Minimal Dark Mode Toggle */
.minimal-toggle {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 16px;
    transition: all 0.2s;
}

.minimal-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* User Profile */
.user-profile {
    flex: 1;
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-info:hover {
    background: rgba(0, 0, 0, 0.05);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.user-email {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Profile Dropdown Menu */
.profile-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s;
    z-index: 1000;
}

.user-profile.active .profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-menu-item {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #dc3545;
    transition: all 0.2s;
    text-align: left;
}

.profile-menu-item:hover {
    background: rgba(220, 53, 69, 0.1);
}

.profile-menu-item i {
    font-size: 14px;
    width: 16px;
}

/* Close button for mobile */
.close-sidebar-mobile {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 16px;
    transition: all 0.2s;
}

.close-sidebar-mobile:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* History Section with Header */
.sidebar-history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-history-icon {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 12px;
    transition: all 0.2s;
}

.clear-history-icon:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    padding: 0 12px 12px 12px;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

/* History Item */
.history-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.history-item:hover {
    background: #e9ecef;
    border-left-color: #2a5298;
}

.history-item-content {
    flex: 1;
    cursor: pointer;
}

.history-item-question {
    font-weight: 600;
    color: #1e3c72;
    margin-bottom: 6px;
    font-size: 14px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-time {
    font-size: 12px;
    color: #666;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.history-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Individual chat delete button */
.delete-chat-btn {
    background: transparent;
    border: none;
    color: #dc3545;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.3s;
    flex-shrink: 0;
}

.history-item:hover .delete-chat-btn {
    opacity: 1;
}

.delete-chat-btn:hover {
    background: rgba(220, 53, 69, 0.1);
    transform: scale(1.1);
}

/* Active conversation highlight */
.history-item.active {
    background: linear-gradient(135deg, #e8f4f8 0%, #d0e8f2 100%);
    border-left-color: #2a5298;
}

/* Dark Mode for Sidebar */
body.dark-mode .history-sidebar {
    background: #2d2d2d;
}

body.dark-mode .sidebar-top {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .new-chat-btn-minimal {
    border-color: rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

body.dark-mode .new-chat-btn-minimal:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .sidebar-bottom {
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .minimal-toggle {
    color: #999;
}

body.dark-mode .minimal-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .user-info:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .user-email {
    color: #e0e0e0;
}

body.dark-mode .profile-menu {
    background: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .profile-menu-item:hover {
    background: rgba(220, 53, 69, 0.2);
}

body.dark-mode .close-sidebar-mobile {
    color: #999;
}

body.dark-mode .close-sidebar-mobile:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .history-header {
    color: #999;
}

body.dark-mode .clear-history-icon {
    color: #777;
}

body.dark-mode .clear-history-icon:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

body.dark-mode .sidebar-content {
    background: #2d2d2d;
}

body.dark-mode .history-item {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .history-item:hover {
    background: #3a3a3a;
}

body.dark-mode .history-item-question {
    color: #6ba3d8;
}

body.dark-mode .delete-chat-btn {
    color: #ff6b6b;
}

body.dark-mode .delete-chat-btn:hover {
    background: rgba(255, 107, 107, 0.1);
}

body.dark-mode .history-item.active {
    background: linear-gradient(135deg, #2a4a6a 0%, #1e3a5a 100%);
}

/* ============================================
   CONFIRMATION MODAL STYLES
   ============================================ */

.confirmation-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.confirmation-modal.active {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeInModal 0.3s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    z-index: 10001;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #f39c12;
}

.modal-title {
    font-size: 22px;
    font-weight: 600;
    color: #1e3c72;
    margin-bottom: 12px;
    text-align: center;
}

.modal-message {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 28px;
    text-align: center;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cancel-btn {
    background: #e0e0e0;
    color: #333;
}

.cancel-btn:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

.confirm-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.confirm-btn:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Dark Mode for Modal */
body.dark-mode .modal-content {
    background: #2d2d2d;
    border: 1px solid #404040;
}

body.dark-mode .modal-title {
    color: #6ba3d8;
}

body.dark-mode .modal-message {
    color: #c0c0c0;
}

body.dark-mode .cancel-btn {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .cancel-btn:hover {
    background: #4a4a4a;
}

/* ========== FEEDBACK BUTTONS ========== */
.feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 0px solid #ffffff00;
}

.feedback-btn {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6b7280;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.feedback-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.feedback-btn:disabled {
    cursor: not-allowed;
}

.feedback-btn i {
    font-size: 14px;
}

.like-btn:hover:not(:disabled) {
    color: #10b981;
    border-color: #10b981;
}

.dislike-btn:hover:not(:disabled) {
    color: #ef4444;
    border-color: #ef4444;
}

/* Dark mode support for feedback buttons */
body.dark-mode .feedback-buttons {
    border-top-color: #374151;
}

body.dark-mode .feedback-btn {
    border-color: #4b5563;
    color: #9ca3af;
}

body.dark-mode .feedback-btn:hover:not(:disabled) {
    background: #374151;
    border-color: #6b7280;
}

/* ========== FEEDBACK NOTE MODAL ========== */
.feedback-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.feedback-modal.active {
    display: flex;
}

.feedback-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.feedback-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: feedbackModalSlideIn 0.3s ease;
}

@keyframes feedbackModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feedback-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.feedback-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.feedback-modal-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.feedback-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.feedback-modal-body {
    padding: 24px;
}

.feedback-modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.feedback-modal-body textarea:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

.feedback-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.feedback-modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.skip-btn {
    background: #f3f4f6;
    color: #6b7280;
}

.skip-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.submit-btn {
    background: #2a5298;
    color: white;
}

.submit-btn:hover {
    background: #1e3c72;
}

/* Dark mode support */
body.dark-mode .feedback-modal-content {
    background: #1f2937;
}

body.dark-mode .feedback-modal-header {
    border-bottom-color: #374151;
}

body.dark-mode .feedback-modal-header h3 {
    color: #f3f4f6;
}

body.dark-mode .feedback-modal-close {
    color: #9ca3af;
}

body.dark-mode .feedback-modal-close:hover {
    background: #374151;
    color: #f3f4f6;
}

body.dark-mode .feedback-modal-body textarea {
    background: #111827;
    border-color: #374151;
    color: #f3f4f6;
}

body.dark-mode .feedback-modal-body textarea:focus {
    border-color: #2a5298;
}

body.dark-mode .feedback-modal-footer {
    border-top-color: #374151;
}

body.dark-mode .skip-btn {
    background: #374151;
    color: #9ca3af;
}

body.dark-mode .skip-btn:hover {
    background: #4b5563;
    color: #f3f4f6;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    body {
        height: 100dvh;
    }
    
    .chat-container {
        height: 100dvh;
    }
    
    .chat-messages {
        max-height: calc(100dvh - 80px - 90px);
        padding: 20px;
    }
    
    .chat-header {
        padding: 12px 20px;
        height: 80px;
    }
    
    .chatbot-icon-container {
        padding-right: 10px;
    }
    
    .chatbot-icon {
        width: 40px;
        height: 40px;
    }

    .chat-title {
        font-size: 16px;
    }

    .chat-title-ar {
        font-size: 13px;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .theme-toggle {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .logo {
        width: 50px;
        height: 50px;
    }

    .message-content {
        max-width: 95%;
    }

    .message.system .message-content {
        max-width: 95%;
        padding: 10px;
    }

    .chat-input-container {
        padding: 15px 20px;
    }

    .chat-input {
        font-size: 14px;
        padding: 14px 20px;
    }

    .send-button {
        padding: 14px 24px;
        font-size: 14px;
    }

    .send-button span:last-child {
        display: none;
    }

    .voice-button {
        width: 46px;
        height: 46px;
        padding: 12px;
    }
    
    ul.bullet-list {
        margin-left: 0;
    }
    
    .bullet-list li.bullet-item {
        padding-left: 24px;
    }
    
    .bullet-list li.bullet-item.sub-item {
        padding-left: 40px;
    }
    
    /* Hide scrollbar on mobile */
    .chat-messages::-webkit-scrollbar {
        display: none;
    }
    
    .chat-messages {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    /* Sidebar mobile */
    .history-sidebar {
        width: 280px;
        left: -100%;
    }
    
    .sidebar-toggle {
        left: 10px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .close-sidebar-mobile {
        display: flex;
    }
    
    .user-email {
        font-size: 12px;
    }
    
    /* Modal mobile */
    .modal-content {
        padding: 24px;
        max-width: 340px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-message {
        font-size: 14px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Desktop-specific adjustments */
@media (min-width: 769px) {
    .message.user .message-content {
        max-width: 70%;
    }
}

/* ========== MOBILE FIX FOR OVERLAPPING BUTTONS ========== */
@media (max-width: 768px) {
    .close-sidebar-mobile {
        display: flex;
        z-index: 10;
    }
    
    /* Add padding to history header to make room for close button */
    .history-header {
        padding-right: 50px !important;
    }
    
    /* Make sure trash icon stays visible */
    .clear-history-icon {
        position: relative;
        z-index: 5;
    }
    
    /* Always show delete buttons on mobile (no hover needed) */
    .delete-chat-btn {
        opacity: 1;
    }
}