/* Import Font */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Tokens (Light Mode) */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-sidebar-active: #eff6ff;
    --sidebar-border: 1px solid var(--border-color);
    --sidebar-text: var(--text-secondary);
    --sidebar-text-hover: var(--primary);
    --sidebar-text-active: var(--primary);
    --sidebar-item-hover-bg: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-on-dark: #f8fafc;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --border-color: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Layout Tokens */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.05), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

/* Dark Mode Tokens */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-sidebar: #0f172a;
    --bg-sidebar-active: #1e293b;
    --sidebar-border: 1px solid rgba(255, 255, 255, 0.08);
    --sidebar-text: var(--text-muted);
    --sidebar-text-hover: var(--text-primary);
    --sidebar-text-active: var(--text-primary);
    --sidebar-item-hover-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: #172554;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.2), 0 2px 4px -2px rgb(0 0 0 / 0.2);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    border-right: var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: var(--sidebar-border);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: 8px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    color: var(--sidebar-text);
    font-weight: 500;
    transition: var(--transition);
}

.menu-item svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    transition: var(--transition);
}

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

.menu-item.active {
    color: var(--sidebar-text-active);
    background-color: var(--bg-sidebar-active);
}

/* Submenu Styling */
.menu-group {
    display: flex;
    flex-direction: column;
}

.submenu {
    padding-left: 12px;
    margin-left: 26px; /* align with parent text */
    border-left: 1.5px solid var(--border-color);
    margin-top: 4px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.25s ease, margin-bottom 0.3s ease;
    margin-bottom: 0;
}

.menu-group.open > .submenu {
    max-height: 300px;
    opacity: 1;
    margin-bottom: 8px;
}

.menu-group > .menu-item .menu-group-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.menu-group.open > .menu-item .menu-group-arrow {
    transform: rotate(180deg);
}

.submenu-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

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

.submenu-item.active {
    color: var(--sidebar-text-active);
    background-color: var(--bg-sidebar-active);
    font-weight: 600;
}



.menu-badge {
    margin-left: auto;
    background-color: var(--success);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: var(--sidebar-border);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: none;
    background: transparent;
    border-radius: var(--border-radius);
    color: #ef4444;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

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

/* Header */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: var(--transition);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    background-color: var(--bg-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    font-size: 0.875rem;
}

.user-name {
    font-weight: 600;
}

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

/* Page Body Content */
.content-body {
    flex: 1;
    padding: 32px;
}

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

.stat-card {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-val {
    font-size: 1.875rem;
    font-weight: 700;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card.success .stat-icon {
    background-color: #ecfdf5;
    color: var(--success);
}

.stat-card.warning .stat-icon {
    background-color: #fffbeb;
    color: var(--warning);
}

.stat-card.danger .stat-icon {
    background-color: #fef2f2;
    color: var(--danger);
}

/* UI Content Layout Blocks */
.dashboard-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.content-card {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.card-body {
    padding: 24px;
}

/* Forms styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
}

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

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

.btn-secondary {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
}

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

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

.btn-danger:hover {
    background-color: #dc2626;
}

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

.btn-success:hover {
    background-color: #059669;
}

/* Tables styling */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    background-color: var(--bg-primary);
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.custom-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

.custom-table tr:hover td {
    background-color: var(--bg-primary);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

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

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

/* Glassmorphic Login Screen */
.login-page {
    background: radial-gradient(circle at 10% 20%, rgb(4, 159, 108) 0%, rgb(194, 254, 113) 90.1%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

[data-theme="dark"] .login-page {
    background: radial-gradient(circle at 10% 20%, rgb(15, 23, 42) 0%, rgb(30, 41, 59) 90.1%);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    padding: 40px;
    transition: var(--transition);
}

[data-theme="dark"] .login-card {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.08);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: white;
    font-weight: 700;
    font-size: 1.75rem;
    border-radius: 16px;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
    margin-bottom: 16px;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-danger {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* Tab-like Left Layout for Member Edit */
.tabbed-layout {
    display: flex;
    gap: 32px;
}

.tab-nav {
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.tab-nav-btn {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    text-align: left;
    transition: var(--transition);
}

.tab-nav-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tab-content {
    flex: 1;
}

/* Pagination container */
.pagination-container {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.pagination-summary {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: 8px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-item {
    display: inline;
}

.page-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    margin-left: -1px;
    line-height: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-weight: 500;
    transition: var(--transition);
}

.page-link:hover {
    color: var(--primary);
    background-color: var(--primary-light);
    border-color: var(--primary);
    text-decoration: none;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: var(--primary);
    border-color: var(--primary);
}

.page-item.disabled .page-link {
    color: var(--text-muted);
    pointer-events: none;
    cursor: not-allowed;
    background-color: var(--bg-primary);
    border-color: var(--border-color);
}

/* Birthday list formatting */
.birthday-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.birthday-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border-left: 4px solid var(--warning);
}

.birthday-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #fffbeb;
    color: var(--warning);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.birthday-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.birthday-details {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mobile-brand {
    display: none;
    align-items: center;
}

.mobile-page-title-bar {
    display: none;
    margin-bottom: 24px;
}

.mobile-page-title-bar h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Responsive Styles */
@media (max-width: 992px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mobile-brand {
        display: flex;
    }
    .header-title {
        display: none;
    }
    .mobile-page-title-bar {
        display: block;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .top-header {
        padding: 0 16px;
    }
    .user-info {
        display: none;
    }
    .content-body {
        padding: 16px;
    }
    .tabbed-layout {
        flex-direction: column;
    }
    .tab-nav {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }
    .tab-nav-btn {
        white-space: nowrap;
    }
}

/* Filter Actions Responsiveness */
.filter-actions {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: flex-end;
    gap: 12px;
}

@media (max-width: 576px) {
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    .filter-actions .btn {
        width: 100%;
    }
    .login-card {
        padding: 24px 16px;
    }
    .login-header {
        margin-bottom: 16px;
    }
    .login-title, .login-subtitle {
        display: none;
    }
    .login-logo-container {
        margin-bottom: 8px !important;
    }
}


/* Media Browser */
.media-browser-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.media-browser-overlay.open {
    display: flex;
}

.media-browser-modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 780px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.media-browser-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.media-browser-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}

.media-browser-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.media-browser-upload-btn {
    margin: 0;
}

.media-browser-status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.media-browser-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 20px;
    overflow-y: auto;
}

.media-browser-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
    font-size: 0.9rem;
}

.media-browser-item {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-primary, transparent);
}

.media-browser-thumb {
    width: 100%;
    padding-top: 100%;
    background-size: cover;
    background-position: center;
    background-color: var(--border-color);
}

.media-browser-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.media-browser-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: #ef4444;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
}

.media-browser-select-btn {
    position: absolute;
    inset: 0;
    bottom: 24px;
    background: rgba(37, 99, 235, 0.85);
    color: white;
    border: none;
    opacity: 0;
    cursor: pointer;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.media-browser-item:hover .media-browser-select-btn {
    opacity: 1;
}

.media-browser-open-btn {
    margin-left: 8px;
}

/* Horizontal tab nav inside a content-card (e.g. dashboard birthday card) */
.card-tab-nav {
    display: flex;
    gap: 8px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-tab-nav-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 4px;
    margin-bottom: -1px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.card-tab-nav-btn:hover {
    color: var(--text-primary, var(--primary));
}

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

/* Generic modal (e.g. "Yeni Temsilci Ekle") */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal-box {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

/* DataTables (member/rep lists): theme to match the app + avoid a flash of
   unstyled content by hiding the table until DataTables has initialized. */
table[data-datatable] {
    visibility: hidden;
}

table[data-datatable].dt-ready {
    visibility: visible;
}

.dataTables_wrapper .dataTables_filter {
    margin-bottom: 16px;
}

.dataTables_wrapper .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* When a DataTable's dom puts the length select and search box in the same
   "top" wrapper div (no export buttons), keep them on one row instead of
   the search box wrapping onto its own line. */
.dataTables_wrapper .top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px 0;
}

.dataTables_wrapper .top .dataTables_length,
.dataTables_wrapper .top .dataTables_filter {
    margin: 0;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 10px 16px 10px 40px;
    border-radius: 10px;
    border: 2px solid var(--primary);
    background-color: var(--bg-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 18px;
    color: var(--text-primary);
    font-size: 0.95rem;
    min-width: 280px;
    margin-left: 0;
    transition: var(--transition);
}

.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

@media (max-width: 576px) {
    .dataTables_wrapper .dataTables_filter input {
        min-width: 0;
        width: 100%;
    }
}

.dataTables_wrapper .dataTables_length select {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0 6px;
}

.dataTables_wrapper .dt-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* Export buttons reuse the app's own .btn/.btn-secondary component
   (set via the DataTable's `buttons[].className`) instead of DataTables'
   default look. The vendor buttons.dataTables.min.css loads after this
   file, so pin the visual properties with !important to make sure our
   theme wins instead of the vendor's boxy default button style. */
.dataTables_wrapper .dt-buttons .btn {
    margin: 0 !important;
    padding: 8px 16px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border-color) !important;
    background-color: var(--bg-secondary) !important;
    background-image: none !important;
    color: var(--text-secondary) !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.dataTables_wrapper .dt-buttons .btn:hover,
.dataTables_wrapper .dt-buttons .btn:focus,
.dataTables_wrapper .dt-buttons .btn.active {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
    background-color: var(--primary-light) !important;
}

/* Sort indicators: DataTables' default sprite icons are faint on our
   background, so replace them with clear, always-visible arrow glyphs. */
table[data-datatable] thead th.sorting,
table[data-datatable] thead th.sorting_asc,
table[data-datatable] thead th.sorting_desc {
    position: relative;
    padding-right: 26px !important;
    cursor: pointer;
    background-image: none !important;
}

table[data-datatable] thead th.sorting::after,
table[data-datatable] thead th.sorting_asc::after,
table[data-datatable] thead th.sorting_desc::after {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    line-height: 1;
    color: var(--text-muted);
}

table[data-datatable] thead th.sorting::after {
    content: '\2195';
}

table[data-datatable] thead th.sorting_asc::after {
    content: '\2191';
    color: var(--primary);
}

table[data-datatable] thead th.sorting_desc::after {
    content: '\2193';
    color: var(--primary);
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary);
    margin-top: 12px;
}

.dataTables_wrapper .paginate_button {
    padding: 6px 12px !important;
    margin-left: 4px;
    border-radius: 6px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
}

.dataTables_wrapper .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}

.dataTables_wrapper .paginate_button.disabled {
    opacity: 0.5;
}

table[data-datatable] thead th {
    white-space: nowrap;
}
