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

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

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

.admin-login-container {
    width: 100%;
    max-width: 400px;
}

.admin-login-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

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

.admin-login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.admin-login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.admin-login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-error {
    display: none;
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    color: var(--danger-color);
    font-size: 14px;
}

.admin-login-btn {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.admin-login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.admin-login-footer p {
    color: var(--text-muted);
    font-size: 12px;
}

.admin-login-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.admin-login-footer a:hover {
    text-decoration: underline;
}

/* Super Admin Badge */
.super-admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* Form Hints */
.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Form Success */
.form-success {
    display: none;
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    color: #166534;
    font-size: 14px;
}

/* Admin Cards */
.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s;
}

.admin-card:hover {
    box-shadow: var(--shadow-md);
}

.admin-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-card-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.admin-card-info {
    flex: 1;
}

.admin-card-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.admin-card-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.admin-card-role {
    display: flex;
    align-items: center;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-admin {
    background: #dbeafe;
    color: #1e40af;
}

.role-superadmin {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.admin-card-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.admin-card-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.delete-admin-btn {
    margin-left: auto;
    padding: 6px 12px;
    background: #fef2f2;
    color: var(--danger-color);
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-admin-btn:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.protected-badge {
    margin-left: auto;
    padding: 6px 12px;
    background: var(--background);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 11px;
    font-weight: 500;
}

.no-accounts,
.error-message {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.error-message {
    color: var(--danger-color);
}

/* Admin Management Section */
.admin-management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.admin-management-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: box-shadow 0.2s;
}

.admin-management-card:hover {
    box-shadow: var(--shadow-md);
}

.admin-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-item .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item .stat-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.admin-card-actions {
    display: flex;
    gap: 8px;
}

.action-btn-secondary,
.action-btn-danger {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.action-btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.action-btn-danger {
    background: #fef2f2;
    color: var(--danger-color);
    border: 1px solid #fecaca;
}

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

.no-admins,
.loading-admins,
.error-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

.loading-admins {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.loading-admins::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.error-loading {
    color: var(--danger-color);
}

/* Conversations Filters */
.conversations-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    min-width: 150px;
}

.filter-group input {
    min-width: 200px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Status Badges */
.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-resolved {
    background: #d1fae5;
    color: #065f46;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.pagination-btn {
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--border);
}

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

.pagination-info {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Auth Warning */
.auth-warning {
    text-align: center;
    padding: 24px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
}

.auth-warning h3 {
    color: #92400e;
    margin-bottom: 12px;
    font-size: 18px;
}

.auth-warning p {
    color: #78350f;
    margin-bottom: 12px;
    font-size: 14px;
}

.auth-warning a {
    color: #b45309;
    text-decoration: underline;
}

.auth-warning a:hover {
    color: #92400e;
}

/* Admin Dashboard */
.admin-dashboard {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.admin-sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.sidebar-nav-item:hover {
    background: var(--background);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: var(--primary-color);
    color: white;
}

.sidebar-nav-item svg {
    flex-shrink: 0;
    min-width: 20px;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

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

.admin-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.admin-details {
    flex: 1;
    min-width: 0;
}

.admin-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.super-admin-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.admin-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.logout-btn svg {
    flex-shrink: 0;
    min-width: 16px;
}

.admin-main {
    flex: 1;
    margin-left: 280px;
    padding: 32px;
    min-width: 0;
    overflow-x: hidden;
}

.admin-header {
    margin-bottom: 32px;
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.admin-header-text {
    flex: 1;
}

.admin-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.admin-header-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.admin-header-balance {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.header-balance-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.header-balance-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.header-balance-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.header-topup-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

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

.stat-icon-purple {
    background: #8b5cf6;
}

.stat-icon-blue {
    background: #3b82f6;
}

.stat-icon-green {
    background: #22c55e;
}

.stat-icon-orange {
    background: #f59e0b;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
    word-break: break-word;
}

/* Dashboard Sections */
.dashboard-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    overflow-x: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

.btn-secondary {
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-primary svg,
.btn-secondary svg {
    flex-shrink: 0;
    min-width: 16px;
}

/* Chats Table */
.chats-table-container {
    overflow-x: auto;
}

.chats-table {
    width: 100%;
    border-collapse: collapse;
}

.chats-table th,
.chats-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.chats-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chats-table td {
    font-size: 14px;
}

.chats-table tr.no-data td {
    text-align: center;
    color: var(--text-muted);
    padding: 32px;
}

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

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

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-id {
    font-size: 12px;
    color: var(--text-muted);
}

.platform-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.platform-binance { background: #fef3c7; color: #92400e; }
.platform-paypal { background: #dbeafe; color: #1e40af; }
.platform-skrill { background: #fae8ff; color: #86198f; }
.platform-zelle { background: #e9d5ff; color: #6b21a8; }
.platform-cashapp { background: #dcfce7; color: #166534; }
.platform-trustwallet { background: #e0e7ff; color: #3730a3; }
.platform-coinbase { background: #f1f5f9; color: #0f172a; }
.platform-blockchain { background: #dbeafe; color: #1e3a8a; }
.platform-usps { background: #bfdbfe; color: #1e3a8a; }

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

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-closed {
    background: #f1f5f9;
    color: #64748b;
}

.last-message {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
}

.view-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.view-chat-btn svg {
    flex-shrink: 0;
    min-width: 16px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.action-btn svg {
    flex-shrink: 0;
    min-width: 16px;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    margin: 20px;
    animation: slideUp 0.3s ease-out;
}

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

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* Settings Modal */
.settings-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.settings-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.balance-amount {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.balance-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.balance-badge {
    background: var(--success-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.balance-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.topup-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.topup-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 16px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.topup-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

.custom-topup {
    margin-top: 16px;
}

.custom-topup label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.custom-topup-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.custom-topup-input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-primary);
}

.custom-topup-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.custom-topup-input-group button {
    padding: 12px 20px;
    white-space: nowrap;
}

/* Subscription Section */
.subscription-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.subscription-status-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.subscription-status-value {
    font-size: 14px;
    font-weight: 600;
}

.subscription-info {
    background: var(--background);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.subscription-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0;
}

.subscription-info strong {
    color: var(--text-primary);
}

/* Admin Management Section */
.admin-select-group {
    margin-bottom: 16px;
}

.admin-select-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

.admin-select-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
}

.admin-select-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.admin-balance-action {
    margin-top: 16px;
}

.admin-balance-action label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
}

/* Generated Link */
.generated-link-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.link-display {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.link-display input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: monospace;
    background: var(--background);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

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

.copy-btn svg {
    flex-shrink: 0;
    min-width: 16px;
}

.link-note {
    font-size: 12px;
    color: var(--text-muted);
}

.link-details {
    margin-top: 12px;
    padding: 12px;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.link-details .link-note {
    margin-bottom: 4px;
}

.link-details .link-note:last-child {
    margin-bottom: 0;
}

.link-details span {
    font-weight: 600;
    color: var(--text-primary);
}

.link-warning {
    margin-top: 12px;
    padding: 8px 12px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: var(--radius);
    font-size: 12px;
    color: #92400e;
}

/* Admin Chat Page */
.admin-chat-page {
    min-height: 100vh;
    background: var(--background);
}

.admin-chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin-left: 280px;
    overflow-x: hidden;
}

.admin-chat-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

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

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

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

.chat-user-details h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-user-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.chat-user-id {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.status-active {
    background: var(--success-color);
}

.status-dot.status-inactive {
    background: var(--text-muted);
}

.admin-chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.no-messages {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.chat-message {
    display: flex;
    max-width: 70%;
}

.message-admin {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-user {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

.message-admin .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-user .message-content {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-time {
    display: block;
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

.admin-chat-input {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 16px 24px;
}

.chat-input-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    min-width: 0;
}

.input-actions {
    display: flex;
    gap: 8px;
}

.input-action-btn {
    width: 40px;
    height: 40px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.input-action-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

.chat-input-form input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
}

.chat-input-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

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

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dropdown Menu */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 100;
    max-width: 300px;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: var(--background);
}

.dropdown-item svg {
    flex-shrink: 0;
    min-width: 16px;
}

.dropdown-item-danger {
    color: var(--danger-color);
}

.dropdown-item-danger:hover {
    background: #fef2f2;
}

/* Responsive */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 240px;
    }
    
    .admin-main {
        margin-left: 240px;
    }
    
    .admin-chat-container {
        margin-left: 240px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .dashboard-section {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .admin-sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .admin-sidebar.open {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
        padding: 16px;
        padding-top: 80px; /* Space for toggle button */
    }
    
    .admin-header {
        padding-left: 0;
    }

    .admin-header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-header-balance {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: space-between;
        padding-top: 16px;
        border-top: 1px solid var(--border);
    }

    .admin-header h1 {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .dashboard-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .section-header h2 {
        font-size: 16px;
    }
    
    /* Admin Chat Page Mobile */
    .admin-chat-container {
        margin-left: 0;
        padding-top: 60px; /* Space for toggle button */
    }
    
    .admin-chat-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .chat-header-left {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .back-btn {
        display: none; /* Hide back button on mobile, use browser back */
    }
    
    .chat-header-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .chat-user-details h2 {
        font-size: 14px;
    }
    
    .admin-chat-messages {
        padding: 16px;
    }
    
    .chat-message {
        max-width: 85%;
    }
    
    .admin-chat-input {
        padding: 12px 16px;
    }
    
    .chat-input-form {
        flex-wrap: wrap;
    }
    
    .chat-input-form input {
        width: 100%;
        min-width: 0;
    }
    
    .input-actions {
        display: none; /* Hide action buttons on mobile to save space */
    }
    
    .conversations-filters {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-group,
    .filter-group select,
    .filter-group input {
        width: 100%;
        min-width: 0;
    }
    
    .conversations-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chats-table {
        min-width: 600px;
    }
    
    .chats-table th,
    .chats-table td {
        padding: 12px 8px;
        font-size: 12px;
    }
    
    .quick-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .link-display {
        flex-direction: column;
    }
    
    .link-display input {
        width: 100%;
    }
    
    .copy-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Overlay when sidebar is open on mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}

@media (max-width: 480px) {
    .admin-main {
        padding: 12px;
        padding-top: 70px;
    }
    
    .admin-header h1 {
        font-size: 20px;
    }

    .admin-header-subtitle {
        font-size: 12px;
    }

    .header-balance-amount {
        font-size: 20px;
    }

    .header-balance-label {
        font-size: 12px;
    }

    .header-topup-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .stat-label {
        font-size: 10px;
    }
    
    .dashboard-section {
        padding: 12px;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
    
    .admin-chat-header {
        padding: 10px 12px;
    }
    
    .chat-user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .admin-chat-messages {
        padding: 12px;
    }
    
    .chat-message {
        max-width: 90%;
    }
    
    .message-content {
        padding: 10px 12px;
    }
    
    .admin-chat-input {
        padding: 10px 12px;
    }
    
    .send-btn {
        width: 44px;
        height: 44px;
    }
    
    .sidebar-toggle {
        top: 12px;
        left: 12px;
    }
}
