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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

.home-content {
    background: white;
    padding: 60px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.home-content h1 {
    font-size: 36px;
    margin-bottom: 20px;
    color: #333;
}

.home-content p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.home-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

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

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

.login-box h1 {
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

/* Admin Navigation */
.admin-nav {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.admin-nav .nav-link {
    color: #666;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 5px;
    transition: all 0.3s;
}

.admin-nav .nav-link:hover {
    background: #f0f0f0;
    color: #333;
}

.admin-nav .nav-link.active {
    background: #667eea;
    color: white;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dashboard-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.dashboard-card h2 {
    font-size: 16px;
    color: #666;
    margin-bottom: 15px;
}

.stat-number {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    margin: 20px 0;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    color: #333;
}

.back-link {
    color: #667eea;
    text-decoration: none;
    margin-bottom: 20px;
    display: inline-block;
}

.back-link:hover {
    text-decoration: underline;
}

/* Card */
.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.table thead {
    background: #f8f9fa;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

/* Data Table (for conversation history, etc.) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
}

.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

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

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

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

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

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

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #5568d3;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

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

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

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* Badge */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

/* Checkbox List */
.checkbox-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

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

.checkbox-item:hover {
    background: #f9f9f9;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 10px;
}

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

.agent-group h4 {
    color: #667eea;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #667eea;
}

/* Filter Bar */
.filter-bar {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 0;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.modal-header .close {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-header .close:hover {
    color: #333;
}

.modal-body {
    padding: 20px 30px;
    overflow-y: auto;
    flex: 1;
}

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

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

.stat-card .stat-number {
    font-size: 36px;
    margin: 10px 0;
}

/* Info Section */
.info-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.info-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.info-table {
    width: 100%;
}

.info-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

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

.text-muted {
    color: #999;
    font-size: 14px;
}

/* Error Message */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
}

/* Chat Interface */
.chat-container {
    display: flex;
    height: 100vh;
}

.chat-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

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

.sidebar-header h2 {
    font-size: 20px;
    color: #333;
}

.agent-list {
    flex: 1;
    overflow-y: auto;
}

.agent-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.3s;
}

.agent-item:hover {
    background: #f9f9f9;
}

.agent-item.active {
    background: #667eea;
    color: white;
}

.agent-item.active .agent-name {
    color: white;
}

.agent-name {
    font-weight: 500;
    color: #333;
}

.no-agents {
    padding: 20px;
    text-align: center;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #ddd;
}

.chat-header h2 {
    font-size: 20px;
    color: #333;
}

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

.welcome-message {
    text-align: center;
    padding: 40px;
    color: #666;
}

.message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    max-width: 70%;
}

.user-message {
    background: #667eea;
    color: white;
    margin-left: auto;
}

.assistant-message {
    background: white;
    color: #333;
}

.chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #ddd;
    display: none;
    width: 100%;
    box-sizing: border-box;
}

.chat-input form {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.chat-input input {
    flex: 1;
    min-width: 0;
}

/* Loading Dialog */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-overlay.active {
    display: flex;
}

.loading-dialog {
    background: white;
    padding: 40px 60px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-dialog h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

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

.badge-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #28a745;
}

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

/* Button variants */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
}

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