/* =====================================================
   SaaS AI Chatbot Platform - Client Panel Styles
   Modern Dashboard for Client Users
   ===================================================== */

/* Import base styles from admin (shared variables) */
:root {
    /* Colors */
    --primary: #4AB8E6;
    --primary-dark: #3a9dbd;
    --primary-light: #70ccf0;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Neutrals */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 8px;
    --border-radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition: all 0.2s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

h1 {
    font-size: 1.875rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.125rem;
}

/* Login Page - Gradient background */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4AB8E6 0%, #3a9dbd 100%);
    padding: 1rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.login-logo .icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.login-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-title h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.login-title p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    background: white;
    color: var(--gray-800);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

.form-text {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.375rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
}

/* Layout */
.client-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: #fdfdfd;
    border-right: 1px solid var(--gray-200);
    color: var(--gray-800);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-logos-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.sidebar-logo img,
.company-logo-sidebar {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.logo-separator {
    width: 1px;
    height: 20px;
    background: var(--gray-300);
}

.sidebar-company {
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 0.25rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    padding: 0.5rem 1.5rem;
    margin-top: 1rem;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-600);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

.nav-item .icon {
    width: 20px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    font-size: 0.6875rem;
    padding: 0.125rem 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
}

.header {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title h1 {
    font-size: 1.25rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.user-role {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Page Content */
.page-content {
    padding: 1.5rem;
}

/* Bot Cards Grid */
.bots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.bot-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.bot-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.bot-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.bot-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.bot-info {
    flex: 1;
    margin-left: 1rem;
}

.bot-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.bot-description {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.bot-card-body {
    padding: 1.5rem;
}

.bot-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bot-stat {
    text-align: center;
}

.bot-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.bot-stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.bot-card-actions {
    display: flex;
    gap: 0.5rem;
}

.bot-card-actions .btn {
    flex: 1;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.stat-icon.primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.stat-icon.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.stat-icon.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.stat-icon.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.stat-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.125rem;
}

.stat-content p {
    color: var(--gray-500);
    font-size: 0.8125rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 1rem 1.25rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    background: var(--gray-50);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Conversations List */
.conversations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    transition: var(--transition);
}

.conversation-item:hover {
    background: var(--gray-50);
}

.conversation-item:last-child {
    border-bottom: none;
}

.conversation-avatar {
    width: 40px;
    height: 40px;
    background: var(--gray-200);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    margin-right: 1rem;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.conversation-name {
    font-weight: 500;
    font-size: 0.9375rem;
}

.conversation-time {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.conversation-preview {
    font-size: 0.875rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

/* Chat Messages */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 3rem);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--gray-50);
}

.message {
    display: flex;
    margin-bottom: 1rem;
    max-width: 80%;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: var(--gray-300);
    color: var(--gray-600);
    margin-left: 0.75rem;
}

.message.bot .message-avatar,
.message.human .message-avatar {
    background: var(--primary);
    color: white;
    margin-right: 0.75rem;
}

.message.human .message-avatar {
    background: var(--success);
}

.message-content {
    background: white;
    padding: 0.875rem 1.25rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.message.user .message-content {
    background: var(--primary);
    color: white;
}

.message-text {
    font-size: 0.9375rem;
    line-height: 1.5;
}

.message-time {
    font-size: 0.6875rem;
    color: var(--gray-400);
    margin-top: 0.375rem;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.chat-input {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.75rem;
}

.chat-input .form-control {
    flex: 1;
}

/* Documents List */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.document-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
}

.document-card:hover {
    border-color: var(--primary);
}

.document-icon {
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.document-icon.pdf {
    background: #fee2e2;
    color: #ef4444;
}

.document-icon.image {
    background: #e0f2fe;
    color: #0ea5e9;
}

.document-icon.text {
    background: #f0fdf4;
    color: #22c55e;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.document-actions {
    display: flex;
    gap: 0.25rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius-lg);
    padding: 3rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area .icon {
    width: 64px;
    height: 64px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: var(--gray-400);
}

.upload-area h3 {
    margin-bottom: 0.5rem;
}

.upload-area p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* Widget Preview */
.widget-preview-container {
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    min-height: 500px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    position: relative;
}

.widget-preview {
    width: 380px;
    max-width: 100%;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.widget-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.widget-messages {
    height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--gray-50);
}

.widget-input {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.5rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.alert-dismissible {
    position: relative;
    padding-right: 3rem;
}

.alert .btn-close {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
    padding: 0.25rem;
}

.alert .btn-close:hover {
    opacity: 1;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: var(--gray-500);
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    cursor: pointer;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state .icon {
    width: 64px;
    height: 64px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: var(--gray-400);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* Code Block */
.code-block {
    background: var(--gray-900);
    color: var(--gray-100);
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    position: relative;
}

.code-block .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    background: var(--gray-700);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
}

.code-block .copy-btn:hover {
    background: var(--gray-600);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: var(--transition);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(24px);
}

/* Color Picker */
.color-picker {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-300);
    cursor: pointer;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--gray-500);
}

.text-small {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.d-flex {
    display: flex;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.w-100 {
    width: 100%;
}

/* Grid */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.75rem;
}

.col {
    padding: 0.75rem;
}

.col-6 {
    width: 50%;
}

.col-4 {
    width: 33.333%;
}

.col-3 {
    width: 25%;
}

.col-8 {
    width: 66.666%;
}

.col-12 {
    width: 100%;
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .col-6,
    .col-4,
    .col-3,
    .col-8 {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .bots-grid {
        grid-template-columns: 1fr;
    }

    .table th,
    .table td {
        padding: 0.75rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px;
        /* Ensure fixed width */
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-toggle {
        display: block !important;
        background: none;
        border: none;
        cursor: pointer;
        font-size: 2rem;
        color: var(--gray-600);
        margin-right: 1rem;
        padding: 0.5rem;
        line-height: 1;
    }

    .header-title h1 {
        font-size: 1rem;
    }
}

.sidebar-toggle {
    display: none;
}