/**
 * APEX配置工具 - 全局样式
 * 参考 art-design-pro 设计风格 - 白色配色版
 */

/* CSS Variables - Light Theme System */
:root {
    /* Primary Colors - 蓝紫色主题 */
    --primary-color: #5D87FF;
    --primary-hover: #4A73E8;
    --primary-light: rgba(93, 135, 255, 0.1);
    --primary-gradient: linear-gradient(135deg, #5D87FF 0%, #B48DF3 100%);

    /* Background Colors - 白色配色 */
    --bg-body: #F5F7FA;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #F8FAFC;
    --bg-hover: rgba(93, 135, 255, 0.06);
    --bg-active: rgba(93, 135, 255, 0.1);

    /* Border Colors */
    --border-color: #E8ECF0;
    --border-hover: #D0D7DE;
    --border-focus: var(--primary-color);

    /* Text Colors */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;

    /* Status Colors */
    --success-color: #13DEB9;
    --success-light: rgba(19, 222, 185, 0.12);
    --warning-color: #FFAE1F;
    --warning-light: rgba(255, 174, 31, 0.12);
    --danger-color: #FF4D4F;
    --danger-light: rgba(255, 77, 79, 0.12);
    --info-color: #5D87FF;
    --info-light: rgba(93, 135, 255, 0.12);

    /* Shadows - 更柔和的阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Font */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-color);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(93, 135, 255, 0.25);
}

.brand-icon svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-menu {
    padding: 16px 0;
    flex: 1;
    overflow-y: auto;
}

.menu-section {
    margin-bottom: 20px;
}

.menu-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 24px;
    margin-bottom: 8px;
}

/* Menu Items - 统一选中效果 */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    margin: 4px 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.menu-item:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.menu-item.active {
    background: var(--bg-active);
    color: var(--primary-color);
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--primary-gradient);
    border-radius: 0 4px 4px 0;
}

.menu-item svg,
.menu-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.menu-item:hover svg,
.menu-item.active svg {
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-body);
}

.top-bar {
    height: 70px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: var(--text-secondary);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px 30px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.stat-content .stat-label,
.stat-info h3 {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-content .stat-value,
.stat-info .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 26px;
    height: 26px;
    color: white;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h2 svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

/* Forms */
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-group {
    margin-bottom: 20px;
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="time"],
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    transition: var(--transition);
}

/* Custom Select Dropdown */
select {
    width: 100%;
    padding: 10px 36px 10px 14px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    font-family: var(--font-family) !important;
    transition: var(--transition);
    cursor: pointer;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
}

select:hover {
    border-color: var(--border-hover) !important;
    background-color: var(--bg-card) !important;
}

select:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    background-color: var(--bg-card) !important;
    box-shadow: 0 0 0 3px rgba(93, 135, 255, 0.12) !important;
}

select option {
    padding: 10px 14px;
    background: var(--bg-card);
    color: var(--text-primary);
}

input:hover,
textarea:hover {
    border-color: var(--border-hover);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(93, 135, 255, 0.12);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(93, 135, 255, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 14px rgba(93, 135, 255, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #13DEB9 0%, #0BB89D 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(19, 222, 185, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #FFAE1F 0%, #E69A00 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 174, 31, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #FF4D4F 0%, #E63E40 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 77, 79, 0.3);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

/* Tables */
.table-wrapper,
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table,
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-secondary);
    vertical-align: middle;
}

tr {
    transition: var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-hover);
}

tbody tr:hover td {
    color: var(--text-primary);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-primary,
.badge-info {
    background: var(--info-light);
    color: var(--info-color);
}

.badge-success {
    background: var(--success-light);
    color: var(--success-color);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger-color);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning-color);
}

.badge-grey {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-muted);
}

.group-badge {
    background: var(--primary-gradient);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
}

/* Status */
.status-active { color: var(--success-color); font-weight: 500; }
.status-inactive { color: var(--danger-color); font-weight: 500; }
.status-expired { color: var(--warning-color); font-weight: 500; }

/* Status Dots */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.dot-green {
    background-color: var(--success-color);
    box-shadow: 0 0 8px rgba(19, 222, 185, 0.4);
}

.dot-red {
    background-color: var(--danger-color);
    box-shadow: 0 0 8px rgba(255, 77, 79, 0.4);
    animation: pulse 1.5s infinite;
}

.dot-grey {
    background-color: var(--text-muted);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.95); }
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: var(--success-light);
    border: 1px solid rgba(19, 222, 185, 0.3);
    color: var(--success-color);
}

.alert-error {
    background: var(--danger-light);
    border: 1px solid rgba(255, 77, 79, 0.3);
    color: var(--danger-color);
}

.alert-warning {
    background: var(--warning-light);
    border: 1px solid rgba(255, 174, 31, 0.3);
    color: var(--warning-color);
}

.alert-info {
    background: var(--info-light);
    border: 1px solid rgba(93, 135, 255, 0.3);
    color: var(--info-color);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.3s ease-out;
    position: relative;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.search-bar input[type="text"] {
    min-width: 220px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    min-width: 320px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.toast-success { border-left: 4px solid var(--success-color); }
.toast.toast-error { border-left: 4px solid var(--danger-color); }
.toast.toast-warning { border-left: 4px solid var(--warning-color); }
.toast.toast-info { border-left: 4px solid var(--info-color); }

.toast-icon { width: 24px; height: 24px; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 14px; color: var(--text-primary); margin-bottom: 4px; }
.toast-message { font-size: 13px; color: var(--text-secondary); }

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
    stroke: var(--success-color);
}

.empty-state p {
    font-size: 16px;
    color: var(--text-muted);
}

/* QQ Duplicate Group */
.qq-duplicate-group {
    background: var(--bg-input);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 1px solid var(--border-color);
}

.qq-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.qq-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.qq-info svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.qq-number {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

/* Risk User Styles */
.risk-rules {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 2.2;
    list-style: none;
    padding: 0;
    margin: 0;
}

.risk-rules li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.risk-rules li .badge {
    flex-shrink: 0;
    min-width: 60px;
    text-align: center;
}

.reason-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reason-list li {
    padding: 4px 0;
    color: var(--warning-color);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reason-list li:before {
    content: "⚠";
    font-size: 11px;
    flex-shrink: 0;
}

.risk-high {
    background: rgba(255, 77, 79, 0.04);
}

.risk-medium {
    background: rgba(255, 174, 31, 0.04);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(93, 135, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(93, 135, 255, 0.4);
}

/* Selection */
::selection {
    background: rgba(93, 135, 255, 0.2);
    color: var(--text-primary);
}

/* Animations */
.card-stagger {
    animation: cardStagger 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.card-stagger:nth-child(1) { animation-delay: 0.05s; }
.card-stagger:nth-child(2) { animation-delay: 0.1s; }
.card-stagger:nth-child(3) { animation-delay: 0.15s; }
.card-stagger:nth-child(4) { animation-delay: 0.2s; }
.card-stagger:nth-child(5) { animation-delay: 0.25s; }

@keyframes cardStagger {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition);
    border-radius: var(--radius-full);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .toggle-slider {
    background: var(--primary-gradient);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Utility Classes */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }

.bg-primary { background: var(--primary-color); }
.bg-success { background: var(--success-color); }
.bg-warning { background: var(--warning-color); }
.bg-danger { background: var(--danger-color); }

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--spacing-xs); }
.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }

.hidden { display: none; }
.w-full { width: 100%; }
.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.shadow { box-shadow: var(--shadow-md); }
.transition { transition: var(--transition); }
.cursor-pointer { cursor: pointer; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        margin-left: 0;
    }
    .top-bar {
        padding: 0 16px;
    }
    .content-wrapper {
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 16px;
    }
    .modal-content {
        margin: 16px;
        padding: 20px;
    }
}

/* User Table Optimized Styles */
.user-table {
    font-size: 13px;
}

.user-table th {
    font-size: 12px;
    padding: 12px 10px;
}

.user-table td {
    padding: 12px 10px;
    vertical-align: middle;
}

/* User Cell - Combined user info */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-avatar-sm.lv1 { background: linear-gradient(135deg, #8E9AAF 0%, #6B7B8D 100%); }
.user-avatar-sm.lv2 { background: linear-gradient(135deg, #5D87FF 0%, #4A6FE0 100%); }
.user-avatar-sm.lv3 { background: linear-gradient(135deg, #13DEB9 0%, #0EBF9E 100%); }
.user-avatar-sm.lv4 { background: linear-gradient(135deg, #FFAE1F 0%, #E09A1A 100%); }
.user-avatar-sm.lv5 { background: linear-gradient(135deg, #FA896B 0%, #E0735A 100%); }
.user-avatar-sm.lv6 { background: linear-gradient(135deg, #FF4D4F 0%, #D63031 100%); }

.user-avatar-sm.risk {
    background: linear-gradient(135deg, #FF4D4F 0%, #E63E40 100%);
    animation: riskPulse 2s infinite;
}

@keyframes riskPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(255, 77, 79, 0); }
}

.user-info {
    min-width: 0;
    flex: 1;
}

.user-info .user-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .admin-tag {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 500;
}

.user-info .user-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.user-info .user-meta span {
    white-space: nowrap;
}

.user-info .note-text {
    color: var(--text-secondary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Expire Cell */
.expire-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.expire-cell .time-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Device Cell */
.device-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.device-cell .login-info {
    font-size: 11px;
    color: var(--text-muted);
}

.device-cell .login-info small {
    color: var(--text-muted);
}

/* IP Cell */
.ip-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 140px;
}

.ip-cell .ip-address {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ip-cell .ip-location {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ip-cell .ip-location.risk-low {
    color: var(--info-color);
}

.ip-cell .ip-location.risk-medium {
    color: var(--warning-color);
}

.ip-cell .ip-location.risk-high {
    color: var(--danger-color);
}

.ip-risk-badge {
    display: inline-block;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.ip-risk-badge.low {
    background: var(--info-light);
    color: var(--info-color);
}

.ip-risk-badge.medium {
    background: var(--warning-light);
    color: var(--warning-color);
}

.ip-risk-badge.high {
    background: var(--danger-light);
    color: var(--danger-color);
}

/* Period Filter */
.period-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}

.period-filter .filter-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* Action Group with Dropdown */
.action-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 120px;
    z-index: 100;
    overflow: hidden;
}

.dropdown-menu.show {
    display: block;
    animation: dropdownFade 0.15s ease-out;
}

@keyframes dropdownFade {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-menu a {
    display: block;
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 13px;
    transition: var(--transition-fast);
    text-decoration: none;
}

.dropdown-menu a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-menu a.danger {
    color: var(--danger-color);
}

.dropdown-menu a.danger:hover {
    background: var(--danger-light);
}

/* Text utilities */
.text-danger { color: var(--danger-color); }
.text-success { color: var(--success-color); }
.text-muted { color: var(--text-muted); }
