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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-btn:hover {
    background: #5a6fd8;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    background: #34495e;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: block;
    padding: 15px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background-color 0.3s;
}

.sidebar-menu a:hover {
    background: #34495e;
}

.sidebar-menu a.active {
    background: #667eea;
    border-left: 4px solid #3498db;
}

/* Sidebar Submenu Styles */
.sidebar-menu ul ul {
    margin-left: 20px;
    background: #34495e;
}

.sidebar-menu ul ul li {
    margin-bottom: 0;
}

.sidebar-menu ul ul a {
    padding: 10px 20px;
    font-size: 14px;
    background: #2c3e50;
}

.sidebar-menu ul ul a:hover {
    background: #34495e;
}

.sidebar-menu ul ul a.active {
    background: #667eea;
    border-left: 4px solid #3498db;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 20px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.user-info .username {
    font-weight: 500;
    color: #333;
}

.user-info .credits {
    color: #27ae60;
    font-weight: 600;
}

.user-info .expire-time {
    color: #e67e22;
    font-size: 12px;
}

/* Content Area Styles */
.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f5f5f5;
}

.content-header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.content-header h2 {
    font-size: 22px;
    color: #333;
    margin-bottom: 10px;
}

.content-header p {
    color: #666;
    font-size: 14px;
}

/* Cards Styles */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 30px;
    margin-bottom: 15px;
    color: #667eea;
}

.card-title {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
}

.card-value {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* Table Styles */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 24px;
    transition: box-shadow 0.3s ease;
}

.table-container:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Search Form Styles - Compact Single-Line Version */
.search-form {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 1px 5px;
    margin-bottom: 2px;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    max-width: 100%;
}

.search-form:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.search-form .form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap; /* 强制一行，超宽时会出现横向滚动，可根据需求改为 wrap */
    overflow-x: auto; /* 如果内容太多，允许横向滚动 */
    padding: 4px 0;
}

.search-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 140px; /* 减小最小宽度，更紧凑 */
}

.search-form label {
    font-weight: 600;
    color: #374151;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-form input[type="text"],
.search-form input[type="date"],
.search-form select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background-color: #ffffff;
    height: 20px;
    box-sizing: border-box;
}

.search-form input[type="text"]:focus,
.search-form input[type="date"]:focus,
.search-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}
/* 优化：紧凑的单选/复选快捷按钮组（如 本周 / 本月） */
.search-form .quick-search {
    display: flex;
    gap: 8px; /* 显著减小组内间距，原16px → 8px */
    align-items: center;
    flex-shrink: 0; /* 防止被压缩变形 */
    white-space: nowrap;
    padding: 0; /* 移除多余padding */
}

.search-form .quick-search label {
    display: flex;
    align-items: center;
    gap: 4px; /* radio圆点和文字之间的距离，保持紧凑 */
    font-weight: 500;
    color: #4b5563;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s ease;
    margin: 0; /* 移除可能存在的默认margin */
    padding: 4px 8px; /* 可选：轻微内边距让点击区域更大 */
    border-radius: 8px;
    transition: all 0.2s ease;
}

.search-form .quick-search label:hover {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.08); /* hover 时轻微背景高亮，更现代 */
}

/* 美化原生 radio 按钮（隐藏默认样式，用自定义圆点） */
.search-form .quick-search input[type="radio"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #9ca3af;
    border-radius: 50%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.search-form .quick-search input[type="radio"]:checked {
    border-color: #667eea;
    background-color: #667eea;
}

.search-form .quick-search input[type="radio"]:checked::after {
    content: '';
    width: 8px;
    height: 8px;
    background-color: white;
    border-radius: 50%;
}

/* 选中状态的文字加粗或变色（更明显） */
.search-form .quick-search input[type="radio"]:checked + span,
.search-form .quick-search label:has(input[type="radio"]:checked) {
    color: #667eea;
    font-weight: 600;
}

.search-form .date-range {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-form .date-range span {
    color: #6b7280;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
}

.search-form .form-actions {
    display: flex;
    gap: 10px;
    margin-left: 12px; /* 与其他控件保持距离 */
    flex-shrink: 0; /* 按钮不被压缩 */
}

.search-form .btn {
    padding: 0 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.search-form .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-form .btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.search-form .btn-primary:hover {
    background: linear-gradient(135deg, #3958e3, #5a3fc0);
}

.search-form .btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
}

.search-form .btn-secondary:hover {
    background-color: #e5e7eb;
}

.search-form .btn-success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.search-form .btn-success:hover {
    background: linear-gradient(135deg, #219653, #27ae60);
}

/* 可选：隐藏滚动条美化（Webkit浏览器） */
.search-form .form-row::-webkit-scrollbar {
    height: 6px;
}

.search-form .form-row::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.table-header {
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
}

.table-header h3 {
    font-size: 20px;
    color: white;
    font-weight: 600;
    margin: 0;
}

.table-content {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.3s ease;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tr {
    transition: all 0.3s ease;
}

table tr:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

table td {
    color: #6c757d;
    font-size: 13px;
}

table td:first-child {
    color: #333;
    font-weight: 500;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.sent {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.failed {
    background-color: #f8d7da;
    color: #721c24;
}

/* Form Styles for Change Password */
.form-container {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    max-width: 500px;
    margin: 0 auto;
}

.form-container h2 {
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.form-row {
    margin-bottom: 20px;
}

.form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-row input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-row input:focus {
    outline: none;
    border-color: #667eea;
}

.save-btn {
    width: 100%;
    padding: 12px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.save-btn:hover {
    background: #219653;
}

/* SMS Chat Styles */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    background: #667eea;
    color: white;
    border-bottom: 1px solid #e9ecef;
}

.chat-header h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.chat-header .phone-number {
    font-size: 14px;
    opacity: 0.9;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-end;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    margin: 0 10px;
    overflow: hidden;
}

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

.sender-avatar {
    background: #667eea;
}

.receiver-avatar {
    background: #34A853;
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message.sent {
    align-items: flex-end;
}

.message.received {
    align-items: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message.sent .message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received .message-content {
    background: white;
    color: #333;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

/* Message Status Styles */
.message-status {
    font-size: 11px;
    margin-top: 5px;
    font-weight: 500;
}

.status-pending {
    color: #ffc107;
}

.status-sent {
    color: #28a745;
}

.status-failed {
    color: #dc3545;
}

.chat-input {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: white;
}

.chat-form {
    display: flex;
    gap: 10px;
}

.chat-form input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
}

.chat-form button {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.chat-form button:hover {
    background: #5a6fd8;
}

/* Chat Page Styles */
.chat-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Chat Header Buttons */
.chat-header-buttons {
    display: flex;
    gap: 10px;
}

/* Chat Tabs and Search */
.chat-tabs-search {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.chat-tabs {
    display: flex;
    gap: 5px;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #f8f9fa;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.chat-search {
    position: relative;
    width: 300px;
}

.chat-search input {
    width: 100%;
    padding: 10px 30px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Chat Main Area */
.chat-main {
    display: flex;
    gap: 20px;
    height: calc(100vh - 250px);
}

/* Chat Sessions */
.chat-sessions {
    width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.session-item:hover {
    background: #f8f9fa;
}

.session-item.active {
    background: #e3f2fd;
    border-left: 4px solid #667eea;
}

.session-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #667eea;
    margin-right: 12px;
}

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

.session-name {
    font-weight: 500;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-last-message {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.session-time {
    font-size: 11px;
    color: #999;
}

.session-unread {
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    padding: 0;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

/* Chat Content */
.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.chat-content-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 16px;
    background: #f8f9fa;
}

/* Chat Content Area */
.chat-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #667eea;
    color: white;
    border-bottom: 1px solid #e9ecef;
}

.chat-contact {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    margin-right: 12px;
}

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

.chat-contact-info {
    display: flex;
    flex-direction: column;
}

.chat-contact-name {
    font-weight: 500;
}

.chat-contact-status {
    font-size: 12px;
    opacity: 0.9;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.chat-actions .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.chat-actions .btn-sm:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Input Area */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid #e9ecef;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal Form Styles */
.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.modal-body textarea, .modal-body input[type="text"], .modal-body select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.modal-body textarea {
    resize: vertical;
    min-height: 100px;
}

/* Image Preview */
#image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-preview-item {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

/* Admin Specific Styles */

/* Button Styles */
.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #219653;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

/* Statistics Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
    border-left: 4px solid #667eea;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.stat-card .change {
    font-size: 12px;
    font-weight: 500;
}

.stat-card .change.positive {
    color: #27ae60;
}

.stat-card .change.negative {
    color: #e74c3c;
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Notification Styles */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
    background: white;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.notification-success {
    border-left: 4px solid #28a745;
    color: #155724;
    background-color: #d4edda;
}

.notification-error {
    border-left: 4px solid #dc3545;
    color: #721c24;
    background-color: #f8d7da;
}

.notification-warning {
    border-left: 4px solid #ffc107;
    color: #856404;
    background-color: #fff3cd;
}

.notification-content {
    flex: 1;
    word-break: break-word;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    margin-left: 15px;
    padding: 0;
    color: inherit;
}

.notification-close:hover {
    opacity: 1;
}

.table-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

/* Filter Section */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-section .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.expired {
    background: #fff3cd;
    color: #856404;
}

/* Alert Messages */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Notification Styles */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
    background: white;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification-content {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    margin-left: 15px;
    color: inherit;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    opacity: 1;
}

.notification-success {
    border-left: 4px solid #28a745;
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.notification-error {
    border-left: 4px solid #dc3545;
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.notification-warning {
    border-left: 4px solid #ffc107;
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.notification-info {
    border-left: 4px solid #17a2b8;
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .sidebar-header {
        font-size: 16px;
    }
    
    .sidebar-menu a {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .header {
        padding: 10px 15px;
    }
    
    .header-left h1 {
        font-size: 18px;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .content {
        padding: 15px;
    }
    
    .cards,
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-actions {
        flex-direction: column;
    }
    
    /* Chat Page Responsive */
    .chat-main {
        flex-direction: column;
        height: auto;
    }
    
    .chat-sessions {
        width: 100%;
        max-height: 300px;
    }
    
    .chat-tabs-search {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .chat-search {
        width: 100%;
    }
    
    .chat-header-buttons {
        flex-wrap: wrap;
    }
}
