/* Custom CSS for Zalo Account Manager */

:root {
    --sidebar-width: 250px;
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.sidebar-nav .nav-link:hover {
    color: white;
    background-color: rgba(255,255,255,0.1);
}

.sidebar-nav .nav-link.active {
    color: white;
    background-color: rgba(255,255,255,0.2);
    border-right: 3px solid white;
}

.sidebar-nav .nav-link i {
    margin-right: 0.75rem;
    width: 16px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 2rem;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Stats Cards */
.stats-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-2px);
}

.stats-card .stats-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.stats-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0,0,0,0.125);
    border-radius: 10px 10px 0 0 !important;
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    color: var(--dark-color);
}

/* Status badges */
.status-active {
    background-color: var(--success-color);
}

.status-inactive {
    background-color: var(--danger-color);
}

.status-pending {
    background-color: var(--warning-color);
}

.status-connected {
    background-color: var(--info-color);
}

/* Buttons */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* QR Code */
.qr-container {
    text-align: center;
    padding: 2rem;
}

.qr-code {
    max-width: 300px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 1rem;
    background: white;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Progress bars */
.progress {
    height: 8px;
    border-radius: 4px;
}

/* Loading states */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Toast notifications */
.toast-container {
    z-index: 1055;
}

.toast {
    border: none;
    border-radius: 8px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Activity feed */
.activity-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.125);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 0.875rem;
}

.activity-content {
    flex: 1;
}

.activity-content small {
    color: #6c757d;
}

/* File upload area */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { 
        transform: translateY(20px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Custom utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.border-dashed {
    border-style: dashed !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* Dark mode toggle */
.dark-mode {
    background-color: #1a1a1a;
    color: #ffffff;
}

.dark-mode .card {
    background-color: #2d2d2d;
    border-color: #404040;
}

.dark-mode .form-control,
.dark-mode .form-select {
    background-color: #3d3d3d;
    border-color: #555555;
    color: #ffffff;
}

.dark-mode .table {
    color: #ffffff;
}

.dark-mode .table th {
    border-color: #555555;
}

/* Group Search Autocomplete */
.group-autocomplete {
    position: relative;
}

.group-dropdown {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: white;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 1050;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
}

.group-dropdown .dropdown-item {
    border: none;
    padding: 10px 15px;
    transition: background-color 0.15s ease-in-out;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.group-dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

.group-dropdown .dropdown-item.active,
.group-dropdown .dropdown-item:active {
    background-color: var(--primary-color);
    color: white;
}

.group-dropdown .dropdown-item:last-child {
    border-bottom: none;
}

.group-dropdown .dropdown-item img {
    object-fit: cover;
}

.group-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    color: #666;
    flex-shrink: 0;
}

.group-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.group-name {
    font-weight: 500;
    font-size: 14px;
    line-height: 1.2;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-members {
    font-size: 12px;
    color: #666;
    line-height: 1;
}

.group-dropdown .dropdown-item.active .group-members,
.group-dropdown .dropdown-item:active .group-members {
    color: rgba(255, 255, 255, 0.8);
}

/* Dark mode for group dropdown */
.dark-mode .group-dropdown {
    background: #2d3338;
    border-color: #555555;
}

.dark-mode .group-dropdown .dropdown-item {
    color: #ffffff;
    border-bottom-color: #555555;
}

.dark-mode .group-dropdown .dropdown-item:hover {
    background-color: #3e4449;
}

.dark-mode .group-avatar {
    background-color: #555555;
    color: #a0aec0;
}

.dark-mode .group-members {
    color: #a0aec0;
}

/* Group input disabled state */
#group-search-input:disabled,
#edit-group-search-input:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.dark-mode #group-search-input:disabled,
.dark-mode #edit-group-search-input:disabled {
    background-color: #2d3338;
    color: #6c757d;
}

/* AI Chat Styles */
.ai-chat-container {
    height: calc(100vh - 60px);
}

.conversation-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.conversation-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.conversation-item.active {
    background-color: rgba(0, 123, 255, 0.2);
    border-left: 3px solid var(--primary-color);
}

.conversation-item.active .p-2 {
    background-color: transparent !important;
}

#messages-container {
    max-height: calc(100vh - 250px);
    min-height: 400px;
}

.message-bubble {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    max-width: none;
    word-wrap: break-word;
    line-height: 1.5;
}

.user-message .message-content {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
}

.ai-message .message-content {
    border: 1px solid #dee2e6;
}

.typing-animation {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.typing-animation span {
    width: 8px;
    height: 8px;
    background-color: #6c757d;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-animation span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-animation span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Message input auto-resize */
#message-input {
    min-height: 38px;
    max-height: 120px;
    overflow-y: auto;
}

/* Scrollbar styling */
.ai-chat-container ::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-container ::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-chat-container ::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ai-chat-container ::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Dark mode for AI Chat */
.dark-mode .ai-chat-container {
    background-color: #1a1a1a;
    color: #ffffff;
}

.dark-mode .conversation-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .conversation-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: #4dabf7;
}

.dark-mode .ai-message .message-content {
    background-color: #2d3338 !important;
    color: #ffffff;
    border-color: #495057;
}

.dark-mode .bg-light {
    background-color: #2d3338 !important;
    color: #ffffff !important;
    border-color: #495057 !important;
}

.dark-mode .border-bottom {
    border-color: #495057 !important;
}

.dark-mode .border-end {
    border-color: #495057 !important;
}

.dark-mode .border-top {
    border-color: #495057 !important;
}

.dark-mode .bg-white {
    background-color: #343a40 !important;
    color: #ffffff !important;
}

.dark-mode .text-muted {
    color: #adb5bd !important;
}

.dark-mode .typing-animation span {
    background-color: #adb5bd;
}

.dark-mode .ai-chat-container ::-webkit-scrollbar-track {
    background: #2d3338;
}

.dark-mode .ai-chat-container ::-webkit-scrollbar-thumb {
    background: #495057;
}

.dark-mode .ai-chat-container ::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* Responsive design for AI Chat */
@media (max-width: 768px) {
    .ai-chat-container .col-md-3 {
        position: absolute;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 1001;
        height: 100%;
        background: white;
    }
    
    .ai-chat-container .col-md-3.show {
        left: 0;
    }
    
    .ai-chat-container .col-md-9 {
        width: 100%;
    }
    
    .dark-mode .ai-chat-container .col-md-3 {
        background: #1a1a1a;
    }
}

/* Welcome message styling */
.ai-chat-container .fa-robot {
    opacity: 0.8;
}

/* AI Chat Conversation List Styling */
.conversation-item {
    cursor: pointer;
    transition: all 0.2s ease;
}

.conversation-item.active {
    background-color: #e3f2fd !important;
    border-left: 4px solid var(--primary-color);
}

.conversation-hover:hover {
    background-color: #f5f5f5;
    transform: translateX(2px);
}

.conversation-item.active .conversation-hover:hover {
    background-color: #e3f2fd;
}

.dark-mode .conversation-hover:hover {
    background-color: #2a2a2a;
}

.dark-mode .conversation-item.active {
    background-color: #1e3a5f !important;
    border-left: 4px solid var(--primary-color);
}

/* Message code styling */
.message-text code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.dark-mode .message-text code {
    background-color: rgba(255, 255, 255, 0.1);
}

/* File Upload Areas */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #6c757d;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
    color: var(--primary-color);
}

.file-upload-area.dragover {
    border-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.file-upload-area i {
    color: inherit;
}

/* Attachment Previews */
.attachment-preview {
    background-color: white;
    border: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.attachment-preview:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.attachment-preview .btn-danger {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.attachment-preview:hover .btn-danger {
    opacity: 1;
}

/* Post Attachment Styling */
#post-attachment-preview {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

#post-attachment-list {
    gap: 0.5rem !important;
}

#post-attachment-list .attachment-preview {
    flex-shrink: 0;
}
