/* ========================
   ADMIN PANEL STYLES
   ======================== */

.admin-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 5% 100px;
}

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

.admin-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #00f2ff 0%, #bc13fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.admin-header p {
    color: var(--text-dim);
    font-size: 1.1rem;
}

.admin-card {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 30px;
    backdrop-filter: blur(20px);
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.admin-card-header h2 {
    font-size: 1.3rem;
    margin: 0;
}

.badge {
    background: var(--primary-gradient);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Add User Row */
.add-user-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 18px;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    flex: 1;
    min-width: 250px;
    transition: border-color 0.3s;
}

.admin-input.small {
    flex: 0.5;
    min-width: 150px;
}

.admin-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

.admin-input::placeholder {
    color: var(--text-dim);
}

.studio-btn.primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.studio-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 242, 255, 0.2);
}

.status-msg {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.status-msg.success {
    color: #10b981;
}

.status-msg.error {
    color: #ef4444;
}

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

.users-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-dim);
    font-weight: 400;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
}

.users-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

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

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

.users-table tr.admin-row td {
    background: rgba(0, 242, 255, 0.03);
}

.email-cell {
    color: var(--accent-cyan);
    font-weight: 500;
}

.date-cell {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.role-badge.admin {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-cyan);
}

.role-badge.user {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.actions-cell {
    text-align: right;
}

.remove-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
}

.remove-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.self-badge {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-style: italic;
}

.loading-cell, .error-cell {
    text-align: center;
    padding: 40px !important;
    color: var(--text-dim);
}

.error-cell {
    color: #ef4444;
}

/* Info Card */
.info-card ol {
    padding-left: 20px;
    color: var(--text-dim);
    line-height: 2;
}

.info-card ol li strong {
    color: var(--text-main);
}

/* Nav Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-badge {
    color: var(--accent-cyan);
    font-size: 0.85rem;
    padding: 6px 14px;
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 20px;
}

.logout-btn {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
}

.logout-btn:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

/* ========================
   SESSION BROWSING MODAL
   ======================== */

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(20px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-surface); border: 1px solid var(--glass-border);
    border-radius: 24px; max-width: 800px; width: 90%; max-height: 80vh;
    display: flex; flex-direction: column; overflow: hidden; animation: slideUp 0.3s ease;
}

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

.modal-header h3 { font-size: 1.2rem; color: var(--text-main); }

.modal-close {
    background: none; border: none; color: var(--text-dim); font-size: 1.2rem;
    cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: all 0.2s;
}

.modal-close:hover { background: rgba(255,255,255,0.05); color: white; }

.modal-body { flex: 1; overflow-y: auto; padding: 16px 24px; }

.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

.modal-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; border-top: 1px solid var(--glass-border);
}

.modal-session-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border: 1px solid var(--glass-border); border-radius: 12px;
    margin-bottom: 8px; transition: all 0.2s;
}

.modal-session-item:hover { background: rgba(255,255,255,0.03); border-color: rgba(0,242,255,0.2); }

.modal-session-info { flex: 1; cursor: pointer; }

.modal-session-title { display: block; font-weight: 500; color: var(--text-main); margin-bottom: 4px; font-size: 0.9rem; }

.modal-session-meta { display: block; font-size: 0.75rem; color: var(--text-dim); }

.remove-btn.small { padding: 4px 10px; font-size: 0.75rem; }

.modal-back-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; margin-bottom: 12px; border-bottom: 1px solid var(--glass-border);
}

.modal-back-bar .back-btn {
    background: none; border: 1px solid var(--glass-border); color: var(--accent-cyan);
    padding: 6px 14px; border-radius: 8px; cursor: pointer; font-family: 'Inter', sans-serif;
    font-size: 0.8rem; transition: all 0.2s;
}

.modal-back-bar .back-btn:hover { background: rgba(0,242,255,0.1); border-color: var(--accent-cyan); }

.modal-messages-list { display: flex; flex-direction: column; gap: 12px; }

.modal-message {
    padding: 14px 18px; border-radius: 12px; border: 1px solid var(--glass-border);
    font-size: 0.85rem; line-height: 1.6;
}

.modal-message.user { background: rgba(245,158,11,0.08); }
.modal-message.assistant { background: rgba(255,255,255,0.03); }

.modal-msg-header {
    display: flex; justify-content: space-between; margin-bottom: 6px;
}

.modal-msg-role { font-weight: 600; font-size: 0.75rem; }
.modal-msg-time { color: var(--text-dim); font-size: 0.7rem; }

.modal-msg-content { white-space: pre-wrap; word-break: break-word; color: var(--text-dim); line-height: 1.5; }

.view-sessions-btn {
    background: none; border: none; cursor: pointer; font-size: 0.9rem;
    padding: 2px 6px; border-radius: 4px; margin-left: 6px; transition: all 0.2s;
    vertical-align: middle;
}

.view-sessions-btn:hover { background: rgba(0,242,255,0.1); }

/* Batch input textarea */
.batch-row { margin-bottom: 0; }
.batch-input {
    width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border);
    border-radius: 12px; padding: 14px 18px; color: white; font-family: 'Inter', sans-serif;
    font-size: 0.9rem; resize: vertical; outline: none; transition: border-color 0.3s;
    line-height: 1.6;
}
.batch-input:focus { border-color: var(--accent-cyan); }
.batch-input::placeholder { color: var(--text-dim); }

footer { padding: 30px 5%; border-top: 1px solid var(--glass-border); text-align: center; background: rgba(0,0,0,0.4); }

/* Responsive */
@media (max-width: 768px) {
    .add-user-row {
        flex-direction: column;
    }
    .admin-input, .admin-input.small {
        width: 100%;
        min-width: unset;
    }
    .users-table {
        font-size: 0.8rem;
    }
    .users-table th, .users-table td {
        padding: 10px 8px;
    }
    .users-table .date-cell {
        display: none;
    }
}