/* Portfolio Chat Styles */
.portfolio-chat-container {
    margin-bottom: 36px;
}

.chat-interface {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 1000px; /* Tăng gấp đôi chiều cao 500px -> 1000px */
    transition: all 0.3s ease;
}

.chat-interface:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-header {
    background-color: rgba(30, 41, 59, 0.95);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #ffffff;
}

.chat-badge {
    display: flex;
    gap: 6px;
}

.deep-search-badge {
    background: #9c27b0;
    background: linear-gradient(135deg, #9c27b0 0%, #673ab7 100%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(156, 39, 176, 0.5);
}

/* Desktop version shows "Deep Think" */
@media (min-width: 769px) {
    .deep-search-badge::after {
        content: " Think";
    }
    .deep-search-badge {
        animation: thinkPulse 1.5s ease-in-out infinite;
    }
}

/* Thêm responsive styles cho mobile */
@media (max-width: 768px) {
    .chat-interface {
        height: 600px; /* Chiều cao tốt hơn cho mobile nhưng vẫn gấp đôi so với trước */
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .chat-header {
        padding: 10px 12px;
    }

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

    .chat-badge {
        gap: 4px;
    }

    .deep-search-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(156, 39, 176, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(156, 39, 176, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(156, 39, 176, 0);
    }
}

/* Chat Messages Styles */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;

/* Styles cho chức năng tìm kiếm trong Portfolio Assistant */
.ai-mode-selector {
  display: flex;
  margin-bottom: 10px;
  background: #f5f5f5;
  border-radius: 20px;
  padding: 3px;
  width: auto;
  align-self: center;
}

.mode-btn {
  border: none;
  padding: 8px 15px;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.mode-btn.active {
  background: #2196f3;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-interface {
  display: none;
  flex-direction: column;
  flex: 1;
}

.ai-interface.active {
  display: flex;
}

.search-container {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-input-container {
  display: flex;
  width: 100%;
}

.search-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 20px 0 0 20px;
  font-size: 16px;
}

.search-button {
  background: #2196f3;
  color: white;
  border: none;
  border-radius: 0 20px 20px 0;
  padding: 0 20px;
  cursor: pointer;
  transition: background 0.3s;
}

.search-button:hover {
  background: #0c7cd5;
}

.search-examples {
  font-size: 13px;
  color: #666;
}

.search-example-tag {
  display: inline-block;
  background: #e9f5fe;
  color: #2196f3;
  padding: 3px 8px;
  border-radius: 12px;
  margin: 0 3px;
  cursor: pointer;
}

.search-example-tag:hover {
  background: #d1eafd;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 10px 15px;
  background: white;
  border-radius: 5px;
  margin-top: 10px;
}

.search-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #aaa;
  gap: 10px;
}

.search-result {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.search-result:last-child {
  border-bottom: none;
}

.search-result-content {
  font-size: 15px;
  line-height: 1.6;
}

.search-result-content a {
  color: #2196f3;
  text-decoration: none;
}

.search-result-content a:hover {
  text-decoration: underline;
}

.search-result-citation {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
  font-style: italic;
}

.search-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px;
}

.search-loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #2196f3;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.chat-message {
    display: flex;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 90%;
    animation: fadeIn 0.3s ease;
}

.chat-message.system-message {
    align-self: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 16px;
    max-width: 90%;
}

.chat-message.user-message {
    align-self: flex-end;
    background: rgba(96, 165, 250, 0.2);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.chat-message.ai-message {
    align-self: flex-start;
    background: rgba(18, 24, 38, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.message-content {
    color: #e0e0e0;
    line-height: 1.7;
    font-size: 15px;
    overflow-wrap: break-word;
    word-break: break-word;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.01em;
}

/* Improved text formatting for AI responses */
.message-content p {
    margin-bottom: 12px;
    line-height: 1.8;
}

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

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    color: #ffffff;
    font-weight: 600;
    margin: 16px 0 8px 0;
    line-height: 1.4;
}

.message-content h1 { font-size: 20px; }
.message-content h2 { font-size: 18px; }
.message-content h3 { font-size: 16px; }
.message-content h4 { font-size: 15px; }

.message-content ul,
.message-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 6px;
    line-height: 1.7;
}

.message-content ul li {
    list-style-type: disc;
}

.message-content ol li {
    list-style-type: decimal;
}

.message-content blockquote {
    border-left: 3px solid #60a5fa;
    padding-left: 12px;
    margin: 12px 0;
    font-style: italic;
    color: #cbd5e1;
}

.message-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #fbbf24;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: #e0e0e0;
}

.message-content strong,
.message-content b {
    font-weight: 600;
    color: #ffffff;
}

.message-content em,
.message-content i {
    font-style: italic;
    color: #cbd5e1;
}

.message-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 16px 0;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 14px;
}

.message-content th,
.message-content td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    text-align: left;
}

.message-content th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: #ffffff;
}

.message-content a {
    color: #60a5fa;
    text-decoration: underline;
    word-break: break-all;
}

.message-content a:hover {
    text-decoration: none;
}

.disclaimer-note {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

/* Typing Effect */
.typing-effect {
    display: inline;
    min-height: 1rem;
}

.typing-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: #60a5fa;
    animation: blink 0.8s infinite;
    margin-left: 2px;
    vertical-align: middle;
}

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

/* Deep Think Indicator */
.deep-thinking-indicator, .deep-search-indicator {
    display: inline-block;
    background: rgba(156, 39, 176, 0.2);
    color: #c77dff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Desktop specific deep think styling */
@media (min-width: 769px) {
    .deep-thinking-indicator, .deep-search-indicator {
        background: rgba(96, 165, 250, 0.2);
        color: #60a5fa;
        animation: thinkGlow 2s ease-in-out infinite;
    }
}

/* Loading Animation */
.searching-animation, .thinking-animation {
    color: #60a5fa;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

/* Desktop specific thinking animation */
@media (min-width: 769px) {
    .thinking-animation {
        background: rgba(96, 165, 250, 0.1);
        padding: 8px 12px;
        border-radius: 8px;
        border-left: 3px solid #60a5fa;
        animation: thinkShimmer 2s infinite;
    }
}

.search-progress, .think-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    position: relative;
}

.search-progress::after, .think-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, #9c27b0, #c77dff);
    border-radius: 4px;
    animation: progressAnimation 2s infinite;
}

/* Desktop specific progress animation */
@media (min-width: 769px) {
    .think-progress::after {
        background: linear-gradient(90deg, #60a5fa, #3b82f6);
        animation: thinkProgress 1.8s ease-in-out infinite;
    }
}

@keyframes progressAnimation {
    0% { left: -30%; }
    100% { left: 100%; }
}

/* New smooth animations for desktop deep think */
@keyframes thinkPulse {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(96, 165, 250, 0.8);
        transform: scale(1.02);
    }
}

@keyframes thinkGlow {
    0%, 100% { 
        background: rgba(96, 165, 250, 0.2);
        box-shadow: 0 0 5px rgba(96, 165, 250, 0.3);
    }
    50% { 
        background: rgba(96, 165, 250, 0.3);
        box-shadow: 0 0 15px rgba(96, 165, 250, 0.6);
    }
}



@keyframes thinkShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes thinkProgress {
    0% { 
        left: -30%; 
        background: linear-gradient(90deg, #60a5fa, #3b82f6);
    }
    50% {
        background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    }
    100% { 
        left: 100%; 
        background: linear-gradient(90deg, #60a5fa, #3b82f6);
    }
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #60a5fa;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.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); }
    40% { transform: scale(1); }
}

/* Chat Input Styles */
.chat-input-container {
    padding: 16px;
    background-color: rgba(30, 41, 59, 0.95);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 14px;
    resize: none;
    min-height: 48px;
    max-height: 120px;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 24px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.chat-send-btn:active {
    transform: translateY(0);
}

.chat-send-btn i {
    font-size: 18px;
}

/* Mobile styles */
@media (max-width: 768px) {
    .chat-message {
        max-width: 95%;
        padding: 12px 16px;
    }

    .message-content {
        font-size: 14px;
        line-height: 1.6;
        letter-spacing: 0.02em;
    }

    .message-content h1 { font-size: 18px; }
    .message-content h2 { font-size: 16px; }
    .message-content h3 { font-size: 15px; }
    .message-content h4 { font-size: 14px; }

    .message-content ul,
    .message-content ol {
        padding-left: 18px;
    }

    .message-content li {
        margin-bottom: 4px;
    }

    .message-content blockquote {
        padding-left: 10px;
        margin: 10px 0;
    }

    .message-content pre {
        padding: 10px;
        margin: 10px 0;
        font-size: 12px;
    }

    .message-content code {
        font-size: 12px;
        padding: 1px 4px;
    }

    .message-content table {
        font-size: 12px;
    }

    .message-content th,
    .message-content td {
        padding: 6px 8px;
    }

    .chat-input-container {
        padding: 12px;
    }

    .chat-input {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 42px;
    }

    .chat-send-btn {
        width: 42px;
        height: 42px;
    }

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

    .chat-messages {
        padding: 12px;
    }
}

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

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

.system-message {
    align-self: center;
    max-width: 95%;
}

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

.ai-message {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.user-message .message-content {
    background-color: #3b82f6;
    color: #ffffff;
    border-top-right-radius: 0;
}

.ai-message .message-content {
    background-color: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border-top-left-radius: 0;
}

.system-message .message-content {
    background-color: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border-radius: 12px;
    text-align: center;
}

/* Deep Search Typing Effect */
.typing-effect {
    display: inline-block;
    color: #e0e0e0;
    white-space: pre-wrap;
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 16px;
    background-color: #60a5fa;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

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

.deep-search-indicator {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 11px;
    color: #9c27b0;
    font-weight: 600;
}

.deep-search-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #9c27b0;
    margin-right: 5px;
    animation: pulse-small 2s infinite;
}

@keyframes pulse-small {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

.searching-animation, .thinking-animation {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #9c27b0;
}

.search-progress, .think-progress {
    height: 3px;
    background: linear-gradient(90deg, #9c27b0, #673ab7);
    border-radius: 3px;
    width: 0%;
    animation: progress 2.5s ease-in-out;
}

@keyframes progress {
    0% { width: 0%; }
    100% { width: 100%; }
}


.loading-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background-color: #60a5fa;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.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);
    }
    40% {
        transform: scale(1);
    }
}

.chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: rgba(30, 41, 59, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

.chat-input {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 14px;
    resize: none;
    height: 48px;
    max-height: 120px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.15);
    border-color: #3b82f6;
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #3b82f6;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.disclaimer-note {
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-interface {
        height: 400px;
    }

    .chat-message {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .chat-interface {
        height: 350px;
    }

    .chat-header {
        padding: 14px 16px;
    }

    .chat-messages {
        padding: 14px;
    }

    .chat-input-container {
        padding: 12px;
    }
}

.value-column {
    font-family: 'Inter', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: #60a5fa;
    text-align: right;
}

.result-days-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #60a5fa;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: 12px;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .table-body {
        max-height: 200px;
    }

    .date-column, .value-column {
        font-size: 0.85rem;
    }

    .result-days-badge {
        font-size: 10px;
        padding: 3px 8px;
        margin-left: 8px;
    }
}