/* ========================================
   MyCompany Platform - Metronic-Inspired Theme
   Clean, Modern Enterprise Dashboard
   ======================================== */

/* ========================================
   CSS Custom Properties (Design Tokens)
   ======================================== */
:root {
    /* Layout Dimensions */
    --sidebar-width: 230px;
    --sidebar-collapsed-width: 64px;
    --header-height: 64px;
    
    /* Primary Brand Colors - Deep Blue Accent */
    --primary: #1b84ff;
    --primary-hover: #056ee9;
    --primary-active: #0561cc;
    --primary-light: #e9f3ff;
    --primary-clarity: rgba(27, 132, 255, 0.2);
    
    /* Secondary Colors */
    --success: #17c653;
    --success-light: #dfffea;
    --success-clarity: rgba(23, 198, 83, 0.2);
    
    --info: #7239ea;
    --info-light: #f8f5ff;
    --info-clarity: rgba(114, 57, 234, 0.2);
    
    --warning: #f6c000;
    --warning-light: #fff8dd;
    --warning-clarity: rgba(246, 192, 0, 0.2);
    
    --danger: #f8285a;
    --danger-light: #ffeef3;
    --danger-clarity: rgba(248, 40, 90, 0.2);
    
    /* Neutral Colors - Gray Scale */
    --gray-100: #f9f9f9;
    --gray-200: #f1f1f4;
    --gray-300: #dbdfe9;
    --gray-400: #b5b5c3;
    --gray-500: #99a1b7;
    --gray-600: #78829d;
    --gray-700: #4b5675;
    --gray-800: #252f4a;
    --gray-900: #071437;
    
    /* Background Colors */
    --body-bg: #f5f8fa;
    --card-bg: #ffffff;
    --sidebar-bg: #1c1c21;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.04);
    --sidebar-bg-active: rgba(255, 255, 255, 0.08);
    
    /* Text Colors */
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-muted: var(--gray-500);
    --text-light: var(--gray-400);
    --text-sidebar: rgba(255, 255, 255, 0.7);
    --text-sidebar-hover: #ffffff;
    
    /* Border Colors */
    --border-color: var(--gray-200);
    --border-dashed: var(--gray-300);
    
    /* Shadow System */
    --shadow-xs: 0 0.1rem 0.25rem rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.04);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 1rem 2rem rgba(0, 0, 0, 0.08);
    --shadow-card: 0 3px 4px 0 rgba(0, 0, 0, 0.03);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.125rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    
    /* Font */
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.75rem;
    --font-size-md: 0.9375rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.125rem;
    --font-size-2xl: 1.25rem;
    --font-size-3xl: 1.5rem;
}

/* ========================================
   Base & Reset Styles
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--body-bg);
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

/* Selection */
::selection {
    background-color: var(--primary-clarity);
    color: var(--primary);
}

/* ========================================
   Sidebar Navigation
   ======================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-slow);
    overflow: hidden;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

/* Sidebar Brand */
.sidebar-brand {
    height: var(--header-height);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(27, 132, 255, 0.35);
}

.sidebar-brand-text {
    color: white;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.025em;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar for Sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Nav Section */
.nav-section {
    padding: 0.75rem 1.5rem 0.5rem;
    margin-top: 0.5rem;
}

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

.nav-section-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
    padding-left: 0.75rem;
}

/* Sidebar Links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    margin: 0.125rem 0.75rem;
    color: var(--text-sidebar);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}

.sidebar-link:hover {
    color: var(--text-sidebar-hover);
    background: var(--sidebar-bg-hover);
}

.sidebar-link.active {
    color: var(--text-sidebar-hover);
    background: var(--sidebar-bg-active);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

[dir="rtl"] .sidebar-link.active::before {
    left: auto;
    right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.sidebar-link i {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.75;
}

.sidebar-link:hover i,
.sidebar-link.active i {
    opacity: 1;
}

/* ========================================
   Sidebar Header & Toggle
   ======================================== */

/* Sidebar Header - contains brand and toggle */
.sidebar-header {
    height: var(--header-height);
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Adjust brand padding when in header */
.sidebar-header .sidebar-brand {
    height: auto;
    padding: 0;
    gap: 0.75rem;
}

/* Toggle button */
.sidebar-toggle {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Sidebar link text wrapper */
.sidebar-link-text {
    white-space: nowrap;
    overflow: hidden;
}

/* ========================================
   Collapsed Sidebar Styles
   ======================================== */

/* Collapsed sidebar */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Hide brand text when collapsed */
.sidebar.collapsed .sidebar-brand-text {
    display: none;
}

/* Center brand icon when collapsed */
.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0;
    position: relative;
}

.sidebar.collapsed .sidebar-header .sidebar-brand {
    justify-content: center;
}

/* Hide toggle in collapsed state - show on hover over logo area */
.sidebar.collapsed .sidebar-toggle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    z-index: 10;
}

.sidebar.collapsed:hover .sidebar-toggle {
    opacity: 1;
    visibility: visible;
}

/* Hide logo when collapsed sidebar is hovered */
.sidebar.collapsed .sidebar-brand-icon {
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.sidebar.collapsed:hover .sidebar-brand-icon {
    opacity: 0;
    visibility: hidden;
}

/* Hide section titles when collapsed */
.sidebar.collapsed .nav-section-title {
    display: none;
}

/* Adjust nav section padding when collapsed */
.sidebar.collapsed .nav-section {
    padding: 0.5rem 0;
}

/* Center links when collapsed */
.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
    margin: 0.125rem 0.5rem;
}

/* Hide link text when collapsed */
.sidebar.collapsed .sidebar-link-text {
    display: none;
}

/* Adjust icon size when collapsed */
.sidebar.collapsed .sidebar-link i {
    font-size: 1.25rem;
}

/* Hide active indicator bar when collapsed */
.sidebar.collapsed .sidebar-link.active::before {
    display: none;
}

/* ========================================
   Main Wrapper Adjustment for Collapsed Sidebar
   ======================================== */

/* Adjust main wrapper margin when sidebar is collapsed */
body.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}


/* ========================================
   Main Content Wrapper
   ======================================== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin var(--transition-slow);
}

[dir="rtl"] .main-wrapper {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

/* ========================================
   Top Header
   ======================================== */
.top-header {
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.breadcrumb-nav a {
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.breadcrumb-nav a:hover {
    color: var(--primary);
}

.breadcrumb-nav .separator {
    color: var(--text-light);
    margin: 0 0.25rem;
}

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

/* Language Switch */
.lang-switch {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 0.25rem;
}

.lang-switch button {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-switch button:hover {
    color: var(--text-primary);
}

.lang-switch button.active {
    background: var(--card-bg);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
}

[dir="rtl"] .user-menu {
    padding-left: 0;
    padding-right: 1rem;
    border-left: none;
    border-right: 1px solid var(--border-color);
}

.user-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.btn-logout {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-light);
}

/* ========================================
   Content Area
   ======================================== */
.content-area {
    flex: 1;
    padding: 1.75rem;
}

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header .page-title {
    margin: 0;
}

.page-header > .d-flex,
.page-header > form,
.page-header > a.btn {
    margin-left: auto;
}

[dir="rtl"] .page-header > .d-flex,
[dir="rtl"] .page-header > form,
[dir="rtl"] .page-header > a.btn {
    margin-left: 0;
    margin-right: auto;
}

.page-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
}

/* Form Groups */
.content-area .form-group {
    margin-bottom: 1rem;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: var(--font-size-md);
    color: var(--text-primary);
}

.card-header h3,
.card-header h4,
.card-header h5 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: var(--gray-100);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stats Cards */
.stats-card {
    padding: 1.5rem;
}

.stats-card .stats-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stats-card .stats-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stats-card .stats-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stats-card .stats-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stats-card .stats-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.stats-card .stats-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stats-card .stats-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.stats-card .stats-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-top: 0.75rem;
}

.stats-card .stats-change.up {
    background: var(--success-light);
    color: var(--success);
}

.stats-card .stats-change.down {
    background: var(--danger-light);
    color: var(--danger);
}

/* ========================================
   Forms
   ======================================== */
.form-label {
    display: block;
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-clarity);
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-control:disabled {
    background-color: var(--gray-100);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-select:disabled {
    background-color: var(--gray-100);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Form Control Sizes */
.form-control-sm {
    padding: 0.5rem 0.875rem;
    font-size: var(--font-size-xs);
}

.form-control-lg {
    padding: 0.75rem 1.125rem;
    font-size: var(--font-size-md);
}

/* Textarea */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Form Select - Enhanced Metronic Style */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2399a1b7' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.75rem;
    appearance: none;
    cursor: pointer;
    line-height: 1.5;
}

.form-select:hover {
    border-color: var(--gray-400);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%234b5675' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.form-select:focus {
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%231b84ff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
}

.form-select option {
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.form-select option:checked {
    background: linear-gradient(0deg, var(--primary-light) 0%, var(--primary-light) 100%);
    color: var(--primary);
}

[dir="rtl"] .form-select {
    background-position: left 1rem center;
    padding-right: 1rem;
    padding-left: 2.75rem;
}

/* Select Sizes */
.form-select-sm {
    padding: 0.4rem 2.25rem 0.4rem 0.875rem;
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
    background-size: 10px;
}

.form-select-lg {
    padding: 0.75rem 3rem 0.75rem 1.125rem;
    font-size: var(--font-size-md);
    border-radius: var(--radius-md);
    background-size: 14px;
}

[dir="rtl"] .form-select-sm {
    padding: 0.4rem 0.875rem 0.4rem 2.25rem;
}

[dir="rtl"] .form-select-lg {
    padding: 0.75rem 1.125rem 0.75rem 3rem;
}

/* Custom Select Wrapper (for enhanced styling) */
.select-wrapper {
    position: relative;
    display: block;
}

.select-wrapper .form-select {
    padding-right: 3rem;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    pointer-events: none;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-secondary);
    transition: border-color var(--transition-fast);
}

.select-wrapper:hover::after {
    border-top-color: var(--text-primary);
}

.select-wrapper:focus-within::after {
    border-top-color: var(--primary);
}

[dir="rtl"] .select-wrapper .form-select {
    padding-left: 3rem;
    padding-right: 1rem;
}

[dir="rtl"] .select-wrapper::after {
    right: auto;
    left: 1rem;
}

/* Input Group with Select */
.input-group .form-select {
    border-radius: 0;
}

.input-group .form-select:first-child {
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

.input-group .form-select:last-child {
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

[dir="rtl"] .input-group .form-select:first-child {
    border-radius: 0;
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

[dir="rtl"] .input-group .form-select:last-child {
    border-radius: 0;
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-sm);
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-check-input[type="radio"] {
    border-radius: var(--radius-full);
}

.form-check-input:hover {
    border-color: var(--primary);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
}

.form-check-input[type="radio"]:checked {
    background-image: none;
    position: relative;
}

.form-check-input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: var(--radius-full);
}

.form-check-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
}

/* Validation States */
.is-invalid {
    border-color: var(--danger) !important;
}

.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--danger-clarity) !important;
}

.invalid-feedback,
.field-validation-error {
    display: block;
    font-size: var(--font-size-xs);
    color: var(--danger);
    margin-top: 0.375rem;
    font-weight: 500;
}

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

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: inherit;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.btn:focus {
    outline: none;
}

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

/* Button Sizes */
.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-md);
    border-radius: var(--radius-md);
}

/* Primary Button */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: white;
}

.btn-primary:focus {
    box-shadow: 0 0 0 3px var(--primary-clarity);
}

/* Secondary Button */
.btn-secondary {
    background-color: var(--gray-100);
    border-color: var(--gray-100);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--gray-200);
    border-color: var(--gray-200);
    color: var(--text-primary);
}

/* Success Button */
.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: #14a847;
    border-color: #14a847;
    color: white;
}

/* Danger Button */
.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #d9204a;
    border-color: #d9204a;
    color: white;
}

/* Warning Button */
.btn-warning {
    background-color: var(--warning);
    border-color: var(--warning);
    color: var(--gray-900);
}

.btn-warning:hover {
    background-color: #d9a800;
    border-color: #d9a800;
    color: var(--gray-900);
}

/* Info Button */
.btn-info {
    background-color: var(--info);
    border-color: var(--info);
    color: white;
}

.btn-info:hover {
    background-color: #5f24e0;
    border-color: #5f24e0;
    color: white;
}

/* Light Button */
.btn-light {
    background-color: var(--gray-100);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-light:hover {
    background-color: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--text-primary);
}

/* Outline Buttons */
.btn-outline-primary {
    background-color: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    color: white;
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--text-primary);
}

.btn-outline-success {
    background-color: transparent;
    border-color: var(--success);
    color: var(--success);
}

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

.btn-outline-danger {
    background-color: transparent;
    border-color: var(--danger);
    color: var(--danger);
}

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

.btn-outline-warning {
    background-color: transparent;
    border-color: var(--warning);
    color: var(--warning);
}

.btn-outline-warning:hover {
    background-color: var(--warning);
    color: var(--gray-900);
}

.btn-outline-info {
    background-color: transparent;
    border-color: var(--info);
    color: var(--info);
}

.btn-outline-info:hover {
    background-color: var(--info);
    color: white;
}

/* Light Colored Buttons */
.btn-light-primary {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--primary);
}

.btn-light-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

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

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

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

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

/* Icon Buttons */
.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-icon.btn-lg {
    width: 46px;
    height: 46px;
}

/* ========================================
   Tables - Metronic Style
   ======================================== */
.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0;
}

/* Table Header */
.table thead th {
    background-color: var(--gray-100);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: relative;
}

.table thead th:first-child {
    border-top-left-radius: var(--radius-md);
}

.table thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

[dir="rtl"] .table thead th:first-child {
    border-top-left-radius: 0;
    border-top-right-radius: var(--radius-md);
}

[dir="rtl"] .table thead th:last-child {
    border-top-right-radius: 0;
    border-top-left-radius: var(--radius-md);
}

/* Sortable Headers */
.table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.table thead th.sortable:hover {
    background-color: var(--gray-200);
}

.table thead th.sortable::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 0.5rem;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--gray-400);
    opacity: 0.5;
}

.table thead th.sortable.asc::after {
    border-top: none;
    border-bottom: 4px solid var(--primary);
    opacity: 1;
}

.table thead th.sortable.desc::after {
    border-top: 4px solid var(--primary);
    opacity: 1;
}

/* Table Body */
.table tbody td {
    padding: 0.375rem 1rem;
    vertical-align: middle;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
    background-color: var(--card-bg);
    transition: background-color var(--transition-fast);
}

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

.table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-md);
}

.table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-md);
}

[dir="rtl"] .table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: var(--radius-md);
}

[dir="rtl"] .table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: var(--radius-md);
}

.table tbody tr {
    transition: background-color var(--transition-fast);
}

/* Alternating row backgrounds */
.table tbody tr:nth-of-type(even) td {
    background-color: oklab(0.967 0.000281923 -0.000959437 / 0.4);
}

.table tbody tr:hover td {
    background-color: oklab(0.98 0.000281923 -0.000959437 / 0.5);
}

/* Center badges in table cells */
.table tbody td:not(.actions-cell) .badge {
    display: inline-flex;
    margin: 0 auto;
}

.table tbody td:not(.actions-cell):has(.badge) {
    text-align: center;
}

/* Center header titles for columns containing badges */
/* JavaScript will detect columns with badges and center their headers */
/* This CSS rule ensures headers are centered when JavaScript applies inline style */
.table thead th[style*="text-align: center"] {
    text-align: center !important;
}

/* Checkbox Column */
.table .check-cell {
    width: 50px;
    padding-left: 1.25rem;
    padding-right: 0.5rem;
}

.table .check-cell .form-check {
    margin: 0;
    padding: 0;
    min-height: auto;
}

.table .check-cell .form-check-input {
    margin: 0;
    cursor: pointer;
}

/* Action Column */
/* Table cell links - match small tag styling */
.table tbody td:not(.actions-cell) a:not(.btn-icon):not(.btn):not(.badge) {
    font-size: 0.95em;
    color: var(--bs-secondary-color, #6c757d);
    text-decoration: none;
}

.table tbody td:not(.actions-cell) a:not(.btn-icon):not(.btn):not(.badge):hover {
    color: var(--bs-secondary-color, #6c757d);
    text-decoration: underline;
}


.table .actions-cell {
    width: 80px;
    text-align: center;
    white-space: nowrap;
}

.table .actions-cell .btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    margin-left: 1px;
}

.table .actions-cell .btn-icon:first-child {
    margin-left: 0;
}

.table .actions-cell .btn-icon:hover {
    background-color: var(--gray-200);
    color: var(--text-primary);
}

.table .actions-cell .btn-icon.text-danger:hover {
    background-color: var(--danger-light);
    color: var(--danger);
}

/* Table Row Actions Dropdown */
.table .dropdown-toggle-no-caret::after {
    display: none;
}

/* Table with Card */
.card > .table,
.card > .table-responsive > .table {
    margin-bottom: 0;
}

.card > .table thead th:first-child,
.card > .table tbody td:first-child {
    padding-left: 1.5rem;
}

.card > .table thead th:last-child,
.card > .table tbody td:last-child {
    padding-right: 1.5rem;
}

/* Card removes table border radius (card handles it) */
.card > .table thead th:first-child,
.card > .table thead th:last-child {
    border-radius: 0;
}

.card > .table tbody tr:last-child td:first-child,
.card > .table tbody tr:last-child td:last-child {
    border-radius: 0;
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

/* Table Bordered */
.table-bordered {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.table-bordered thead th {
    border-bottom: 1px solid var(--border-color);
}

.table-bordered tbody td {
    border-bottom: 1px solid var(--border-color);
}

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

/* Striped Table */
.table-striped tbody tr:nth-of-type(odd) td {
    background-color: var(--gray-100);
}

.table-striped tbody tr:nth-of-type(odd):hover td {
    background-color: var(--gray-200);
}

/* Compact Table */
.table-sm thead th {
    padding: 0.625rem 0.75rem;
}

.table-sm tbody td {
    padding: 0.625rem 0.75rem;
}

/* Table Cell Helpers */
.table .cell-label {
    font-weight: 600;
    color: var(--text-primary);
}

.table .cell-sublabel {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.table .cell-highlight {
    font-weight: 600;
    color: var(--primary);
}

/* Status/Severity Badges in Tables */
.table .badge-severity {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: capitalize;
}

.table .badge-severity.critical,
.table .badge-severity.danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

.table .badge-severity.high,
.table .badge-severity.warning {
    background-color: #fff3cd;
    color: #856404;
}

.table .badge-severity.medium,
.table .badge-severity.info {
    background-color: var(--info-light);
    color: var(--info);
}

.table .badge-severity.low,
.table .badge-severity.success {
    background-color: var(--success-light);
    color: var(--success);
}

/* Table Footer */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--gray-100);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    flex-wrap: wrap;
    gap: 1rem;
}

.table-footer-info {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.table-footer-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Per Page Selector */
.per-page-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.per-page-selector .form-select {
    width: auto;
    min-width: 70px;
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    font-size: var(--font-size-sm);
}

[dir="rtl"] .per-page-selector .form-select {
    padding: 0.375rem 0.75rem 0.375rem 2rem;
}

/* Empty Table State */
.table-empty {
    text-align: center;
    padding: 3rem 2rem;
}

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

.table-empty-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.table-empty-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Table Row with Avatar */
.table .user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table .user-cell .avatar {
    flex-shrink: 0;
}

.table .user-cell-info {
    min-width: 0;
}

.table .user-cell-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.table .user-cell-email {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Table Loading State */
.table-loading {
    position: relative;
    min-height: 200px;
}

.table-loading::after {
    content: '';
    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;
    z-index: 10;
}

.table-loading .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
}

/* Selectable Table Rows */
.table-selectable tbody tr {
    cursor: pointer;
}

.table-selectable tbody tr.selected td {
    background-color: var(--primary-light);
}

.table-selectable tbody tr.selected:hover td {
    background-color: var(--primary-clarity);
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    padding: 1rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background-color: var(--success-light);
    border-color: rgba(23, 198, 83, 0.15);
    color: #0d7a32;
}

.alert-danger {
    background-color: var(--danger-light);
    border-color: rgba(248, 40, 90, 0.15);
    color: #b91c41;
}

.alert-warning {
    background-color: var(--warning-light);
    border-color: rgba(246, 192, 0, 0.15);
    color: #92700c;
}

.alert-info {
    background-color: var(--info-light);
    border-color: rgba(114, 57, 234, 0.15);
    color: #5424b3;
}

.alert-dismissible .btn-close {
    padding: 1rem 1.25rem;
}

/* ========================================
   Badges
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35em 0.65em;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    gap: 0.35em;
}

.badge-primary,
.bg-primary {
    background-color: var(--primary) !important;
    color: white;
}

.badge-secondary,
.bg-secondary {
    background-color: var(--gray-500) !important;
    color: white;
}

.badge-success,
.bg-success {
    background-color: var(--success) !important;
    color: white;
}

.badge-danger,
.bg-danger {
    background-color: var(--danger) !important;
    color: white;
}

.badge-warning,
.bg-warning {
    background-color: var(--warning) !important;
    color: var(--gray-900);
}

.badge-info,
.bg-info {
    background-color: var(--info) !important;
    color: white;
}

/* Light Badges */
.badge-light-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.badge-light-success {
    background-color: var(--success-light);
    color: var(--success);
}

.badge-light-danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

.badge-light-warning {
    background-color: var(--warning-light);
    color: #92700c;
}

.badge-light-info {
    background-color: var(--info-light);
    color: var(--info);
}

/* ========================================
   Avatars
   ======================================== */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background-color: var(--gray-200);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: var(--font-size-sm);
    overflow: hidden;
}

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

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-xs);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--font-size-lg);
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: var(--font-size-2xl);
}

.avatar-circle {
    border-radius: var(--radius-full);
}

/* Avatar Colors */
.avatar-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

.avatar-success {
    background-color: var(--success-light);
    color: var(--success);
}

.avatar-warning {
    background-color: var(--warning-light);
    color: #92700c;
}

.avatar-danger {
    background-color: var(--danger-light);
    color: var(--danger);
}

.avatar-info {
    background-color: var(--info-light);
    color: var(--info);
}

/* Avatar Group */
.avatar-group {
    display: inline-flex;
    flex-direction: row-reverse;
}

.avatar-group .avatar {
    margin-left: -0.75rem;
    border: 2px solid var(--card-bg);
    transition: transform var(--transition-fast);
}

.avatar-group .avatar:last-child {
    margin-left: 0;
}

.avatar-group .avatar:hover {
    transform: translateY(-2px);
    z-index: 1;
}

[dir="rtl"] .avatar-group {
    flex-direction: row;
}

[dir="rtl"] .avatar-group .avatar {
    margin-left: 0;
    margin-right: -0.75rem;
}

[dir="rtl"] .avatar-group .avatar:last-child {
    margin-right: 0;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    padding: 1.25rem 1.75rem;
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

/* ========================================
   Login Page (Non-authenticated)
   ======================================== */
.login-wrapper {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: #0b0f1a;
    position: relative;
    overflow: hidden;
}

/* Large curved gradient blob - bottom left */
.login-wrapper::before {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 80%;
    height: 90%;
    background: radial-gradient(ellipse at center, rgba(79, 70, 229, 0.4) 0%, rgba(59, 130, 246, 0.2) 40%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

/* Secondary accent glow - top right */
.login-wrapper::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -15%;
    width: 60%;
    height: 70%;
    background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.15) 0%, rgba(59, 130, 246, 0.08) 40%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}

/* Subtle grid overlay */
.login-bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.login-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    padding: 1rem;
}

/* Brand in login page */
.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.login-brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* White login card */
.login-card {
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 2.5rem;
    width: 100%;
    position: relative;
    z-index: 1;
}

.login-card .login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 1.5rem;
}

.login-card .form-label {
    color: #3a3a4a;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.login-card .form-control {
    background: #f8f9fc;
    border: 1.5px solid #e2e5f1;
    border-radius: 0.75rem;
    padding: 0.7rem 1rem;
    font-size: 0.9375rem;
    color: #1a1a2e;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-card .form-control:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 132, 255, 0.12);
}

.login-card .form-control::placeholder {
    color: #a0a4b8;
}

.login-card .form-group {
    margin-bottom: 1.25rem;
}

.login-card .validation-message {
    color: var(--danger);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    display: block;
}

.login-card .btn-primary {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.9375rem;
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(27, 132, 255, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(27, 132, 255, 0.4);
}

.login-card .remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #5a5a6e;
    font-size: 0.875rem;
}

.login-card .remember-me input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

/* Login divider */
.login-card .login-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    color: #a0a4b8;
    font-size: 0.8125rem;
}

.login-card .login-divider::before,
.login-card .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e5f1;
}

.login-card .login-divider span {
    padding: 0 1rem;
}

/* Google button */
.login-card .btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.7rem;
    border-radius: 0.75rem;
    border: 1.5px solid #e2e5f1;
    background: #ffffff;
    color: #3a3a4a;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: background 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
}

.login-card .btn-google:hover {
    background: #f8f9fc;
    border-color: #d0d4e4;
}

/* Demo credentials */
.login-card .login-demo-creds {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f1f5;
    text-align: center;
}

.login-card .login-demo-creds small {
    color: #8a8ea0;
    font-size: 0.8rem;
    line-height: 1.6;
}

.login-card .login-demo-creds strong {
    color: #5a5a6e;
    font-weight: 600;
}

/* Footer text */
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.8125rem;
}

/* Login page responsive */
@media (max-width: 480px) {
    .login-card {
        padding: 1.75rem 1.5rem;
        border-radius: 1rem;
    }
    
    .login-brand-text {
        font-size: 1.25rem;
    }
    
    .login-content {
        padding: 0.75rem;
    }
}

/* ========================================
   Mobile Toggle
   ======================================== */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.mobile-toggle:hover {
    color: var(--primary);
}

/* ========================================
   Dropdowns (Bootstrap Override) - Metronic Style
   ======================================== */
.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 50px 0 rgba(82, 63, 105, 0.1);
    padding: 0.75rem 0;
    min-width: 200px;
    margin-top: 0.5rem;
    animation: dropdownFadeIn 0.2s ease;
}

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

.dropdown-header {
    padding: 0.5rem 1.25rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-item {
    padding: 0.65rem 1.25rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all var(--transition-fast);
}

.dropdown-item i {
    font-size: 1.1rem;
    color: var(--text-secondary);
    width: 20px;
    text-align: center;
    transition: color var(--transition-fast);
}

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

.dropdown-item:hover i {
    color: var(--primary);
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.dropdown-item.active i,
.dropdown-item:active i {
    color: var(--primary);
}

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

.dropdown-item.text-danger:hover {
    background-color: var(--danger-light);
    color: var(--danger);
}

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

.dropdown-divider {
    border-color: var(--border-color);
    margin: 0.5rem 0;
    opacity: 1;
}

/* Dropdown Toggle Button */
.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-toggle::after {
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    margin-left: 0.25rem;
    vertical-align: middle;
    content: "";
    border: solid var(--text-secondary);
    border-width: 0 2px 2px 0;
    padding: 2px;
    transform: rotate(45deg);
    transition: transform var(--transition-fast);
}

.dropdown-toggle:hover::after {
    border-color: var(--primary);
}

.show > .dropdown-toggle::after {
    transform: rotate(-135deg);
}

/* Dropdown Toggle - No Caret */
.dropdown-toggle-no-caret::after {
    display: none;
}

/* ========================================
   Pagination - Metronic Style
   ======================================== */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 20px 0px 15px 0px;
    padding: 0;
    list-style: none;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    background-color: transparent;
    border: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.page-item .page-link:focus {
    outline: none;
    box-shadow: none;
}

.page-item.active .page-link {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

.page-item.active .page-link:hover {
    background-color: var(--primary-hover);
    color: white;
}

.page-item.disabled .page-link {
    color: var(--text-light);
    pointer-events: none;
    cursor: not-allowed;
}

/* Pagination with Icons */
.page-item .page-link i {
    font-size: 1rem;
}

/* Previous/Next buttons */
.page-item:first-child .page-link,
.page-item:last-child .page-link {
    padding: 0 0.5rem;
}

/* Pagination Sizes */
.pagination-sm .page-link {
    min-width: 30px;
    height: 30px;
    font-size: var(--font-size-xs);
}

.pagination-lg .page-link {
    min-width: 42px;
    height: 42px;
    font-size: var(--font-size-md);
}

/* Pagination Wrapper */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 0;
}

.pagination-info {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.pagination-info strong {
    font-weight: 600;
    color: var(--text-primary);
}

/* ========================================
   Modals (Bootstrap Override)
   ======================================== */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    gap: 0.5rem;
}

/* ========================================
   Tabs (Bootstrap Override)
   ======================================== */
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    padding: 0.75rem 1.25rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    transition: all var(--transition-fast);
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    background-color: transparent;
    border-bottom-color: var(--primary);
}

/* Pills */
.nav-pills {
    gap: 0.5rem;
}

.nav-pills .nav-link {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    background-color: transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

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

.nav-pills .nav-link.active {
    background-color: var(--primary);
    color: white;
}

/* ========================================
   Progress Bars
   ======================================== */
.progress {
    height: 8px;
    background-color: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    background-color: var(--primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

.progress-bar-success {
    background-color: var(--success);
}

.progress-bar-warning {
    background-color: var(--warning);
}

.progress-bar-danger {
    background-color: var(--danger);
}

/* ========================================
   Tooltips (Bootstrap Override)
   ======================================== */
.tooltip-inner {
    background-color: var(--sidebar-bg);
    font-size: var(--font-size-xs);
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
}

/* Tooltip arrow color to match sidebar background */
.bs-tooltip-end .tooltip-arrow::before,
.bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow::before {
    border-right-color: var(--sidebar-bg);
}

.bs-tooltip-start .tooltip-arrow::before,
.bs-tooltip-auto[data-popper-placement^="left"] .tooltip-arrow::before {
    border-left-color: var(--sidebar-bg);
}

/* Ensure tooltips appear above sidebar when collapsed */
.sidebar.collapsed .tooltip {
    z-index: 1200;
}

/* Hide tooltips completely when sidebar is expanded */
.sidebar:not(.collapsed) .tooltip {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

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

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background-color: var(--gray-100);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-light);
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ========================================
   Responsive Styles
   ======================================== */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 260px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0 !important;
    }
    
    [dir="rtl"] .main-wrapper {
        margin-right: 0 !important;
    }
    
    .mobile-toggle {
        display: flex;
    }
    
    /* Backdrop for mobile sidebar */
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }
    
    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 1.25rem;
    }
    
    .top-header {
        padding: 0 1.25rem;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .user-name {
        display: none;
    }
    
    .user-menu {
        padding-left: 0.75rem;
    }
    
    [dir="rtl"] .user-menu {
        padding-right: 0.75rem;
    }
    
    .page-title {
        font-size: var(--font-size-xl);
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

@media (max-width: 576px) {
    .content-area {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header > .d-flex,
    .page-header > form,
    .page-header > a.btn {
        margin-left: 0;
        width: 100%;
    }
    
    .lang-switch {
        display: none;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-primary {
    color: var(--primary) !important;
}

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

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

.text-warning {
    color: var(--warning) !important;
}

.text-info {
    color: var(--info) !important;
}

.fw-medium {
    font-weight: 500 !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

.fs-xs {
    font-size: var(--font-size-xs) !important;
}

.fs-sm {
    font-size: var(--font-size-sm) !important;
}

.fs-md {
    font-size: var(--font-size-md) !important;
}

.fs-lg {
    font-size: var(--font-size-lg) !important;
}

.rounded-sm {
    border-radius: var(--radius-sm) !important;
}

.rounded-md {
    border-radius: var(--radius-md) !important;
}

.rounded-lg {
    border-radius: var(--radius-lg) !important;
}

.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

/* Hover utilities */
.hover-lift {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

/* Separator */
.separator {
    border-bottom: 1px solid var(--border-color);
    margin: 1rem 0;
}

.separator-dashed {
    border-bottom: 1px dashed var(--border-dashed);
}

/* Scroll to top */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    z-index: 1000;
}

.scroll-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

[dir="rtl"] .scroll-top {
    right: auto;
    left: 2rem;
}

/* ========================================
   Flow Execution Settings - Matching Strategies
   ======================================== */
.matching-strategies-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background-color: var(--gray-100);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.matching-strategies-container .form-check {
    padding: 0.75rem;
    margin: 0;
    width: 100%;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-base);
}

.matching-strategies-container .form-check:hover {
    /*background-color: var(--primary-clarity);*/
}

.matching-strategies-container .form-check-label {
    cursor: pointer;
    padding-left: 0.5rem;
}

.matching-strategies-container .form-check-label strong {
    display: block;
    margin-bottom: 0.25rem;
}

.matching-strategies-container .form-check-input:disabled + .form-check-label {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Fuzzy threshold slider */
#fuzzyThresholdContainer .form-range {
    height: 0.5rem;
}

#fuzzyThresholdContainer #fuzzyThresholdValue {
    min-width: 4rem;
    text-align: center;
    display: inline-block;
    padding: 0.35em 0.65em;
}

/* RTL Support for matching strategies */
[dir="rtl"] .matching-strategies-container .form-check {
    padding-right: 0;
    padding-left: 0.75rem;
}

[dir="rtl"] .matching-strategies-container .form-check-label {
    padding-left: 0;
    padding-right: 0.5rem;
}

[dir="rtl"] .matching-strategies-container .badge {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* ========================================
   Bot Details - Command Center
   ======================================== */

/* Setup Progress Card */
.bot-setup-progress .progress {
    height: 8px;
    background-color: var(--gray-200);
    border-radius: var(--radius-full);
}

/* Setup Checklist Steps */
.setup-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.setup-step {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}

.setup-step.completed {
    background-color: var(--success-light);
    color: var(--success);
    border-color: rgba(23, 198, 83, 0.15);
}

.setup-step.completed:hover {
    background-color: rgba(23, 198, 83, 0.25);
}

.setup-step.pending {
    background-color: var(--gray-100);
    color: var(--gray-600);
    border-color: var(--gray-200);
}

.setup-step.pending:hover {
    background-color: var(--gray-200);
    color: var(--gray-700);
}

.setup-step.optional {
    background-color: var(--gray-100);
    color: var(--gray-500);
    border-color: var(--gray-200);
}

.setup-step.optional:hover {
    background-color: var(--info-light);
    color: var(--info);
}

/* Bot Section Cards */
.bot-section-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

.bot-section-card .card-header h6 {
    font-size: 0.875rem;
}

/* Bot Empty States */
.bot-empty-state {
    opacity: 0.85;
}

.bot-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
}

/* Bot Message Cards */
.bot-message-card {
    background-color: var(--gray-100);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.bot-message-card:hover {
    border-color: var(--primary-clarity);
    background-color: var(--primary-light);
}

/* Bot Field Chips */
.bot-field-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--gray-100);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.bot-field-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary-clarity);
    color: var(--primary);
}

.bot-field-chip.required {
    border-color: rgba(27, 132, 255, 0.2);
    background: var(--primary-light);
    color: var(--primary);
}

.bot-field-chip i {
    font-size: 0.875rem;
}

/* Bot Integration Cards */
.bot-integration-card {
    background: var(--gray-100);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.bot-integration-card:hover {
    border-color: var(--primary-clarity);
    background-color: #fff;
    box-shadow: var(--shadow-xs);
}

/* Bot Quick Link Cards */
.bot-quick-link {
    transition: all var(--transition-fast);
    color: var(--text-primary);
}

.bot-quick-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
}

.bot-quick-link h6 {
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* RTL Support for Bot Details */
[dir="rtl"] .bot-quick-link .bi-chevron-right {
    transform: rotate(180deg);
}

[dir="rtl"] .setup-step {
    flex-direction: row-reverse;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .setup-checklist {
        gap: 0.375rem;
    }

    .setup-step {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    .bot-field-chip {
        font-size: 0.7rem;
        padding: 0.375rem 0.625rem;
    }
}

/* ========================================
   Conversation Details - Chat Matches Sidebar
   ======================================== */
.conversation-details-row > .col-md-8 {
    position: relative;
}

.conversation-details-row > .col-md-8 > .card {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    right: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.conversation-details-row > .col-md-8 > .card > .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.chat-history-embed {
    flex: 1;
    min-height: 0;
    overflow: auto;
}
