/* QDI Messenger - Admin Panel Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

/* Admin Login Screen */
.admin-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0a0a 0%, #1e1e1e 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

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

.login-header img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.login-header p {
    color: #999;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #ccc;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #25D366;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.form-group input::placeholder {
    color: #666;
}

.admin-login-btn {
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
}

.admin-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.login-footer {
    text-align: center;
}

.login-footer a {
    color: #999;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.login-footer a:hover {
    color: #25D366;
}

/* Admin Dashboard */
.admin-dashboard {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar */
.admin-sidebar {
    width: 250px;
    min-width: 250px;
    background: #1e1e1e;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #2a2a2a;
}

.sidebar-header img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #999;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-item.active {
    background: rgba(37, 211, 102, 0.1);
    color: #25D366;
    border-left-color: #25D366;
}

.nav-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.2);
    color: #ff4757;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 71, 87, 0.2);
}

/* Main Content */
.admin-main {
    flex: 1;
    background: #0a0a0a;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Sections */
.admin-section {
    padding: 30px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.admin-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 30px;
}

.section-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.section-header p {
    color: #999;
    font-size: 14px;
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(37, 211, 102, 0.3);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    background: rgba(37, 211, 102, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: #25D366;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 14px;
    color: #999;
    font-weight: 500;
}

/* Controls */
.users-controls,
.messages-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.2);
    color: #25D366;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    background: rgba(37, 211, 102, 0.2);
}

.filter-select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #25D366;
}

/* Tables */
.users-table-container,
.messages-table-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    overflow-x: auto;
}

.users-table,
.messages-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.users-table th,
.messages-table th {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.users-table td,
.messages-table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.users-table tr:hover,
.messages-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.loading-cell {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px !important;
}

/* Status Indicators */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
}

.status-indicator.online .status-dot {
    background: #25D366;
}

.status-indicator.offline .status-dot {
    background: #999;
}

/* User Info in Table */
.user-info {
    min-width: 0;
}

.user-info strong {
    display: block;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 2px;
}

.user-info small {
    color: #999;
    font-size: 12px;
}

/* Message Type Badge */
.message-type-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-type-badge.text {
    background: rgba(52, 183, 241, 0.2);
    color: #34B7F1;
}

.message-type-badge.image {
    background: rgba(37, 211, 102, 0.2);
    color: #25D366;
}

.message-type-badge.video {
    background: rgba(255, 167, 38, 0.2);
    color: #ffa726;
}

.message-type-badge.audio {
    background: rgba(156, 39, 176, 0.2);
    color: #9c27b0;
}

.message-type-badge.file {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* Message Content Preview */
.message-content-preview {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ccc;
    font-size: 13px;
}

/* Read Status */
.read-status {
    font-size: 12px;
    font-weight: 500;
}

.read-status.read {
    color: #34B7F1;
}

.read-status.unread {
    color: #ffa726;
}

/* Action Buttons */
.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.action-btn.danger {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.2);
}

.action-btn.danger:hover {
    background: rgba(255, 71, 87, 0.2);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding: 20px;
}

.page-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: rgba(37, 211, 102, 0.1);
    border-color: rgba(37, 211, 102, 0.2);
    color: #25D366;
}

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

#pageInfo {
    color: #999;
    font-size: 14px;
}

/* Settings */
.settings-container {
    max-width: 600px;
}

.settings-group {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.settings-group h3 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.setting-item label {
    font-size: 14px;
    color: #ccc;
    font-weight: 500;
}

.setting-value {
    font-size: 14px;
    color: #25D366;
    font-weight: 600;
    font-family: 'Monaco', 'Consolas', monospace;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: #2a2a2a;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #999;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-secondary {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%);
    border: none;
    color: #ffffff;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}