/* ==========================================
   Admin Dashboard Styles
   ========================================== */

/* Access Denied / Login Required Pages */
.access-denied-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.access-denied-content {
    text-align: center;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 400px;
}

.access-denied-content i {
    font-size: 4rem;
    color: #f59e0b;
    margin-bottom: 1.5rem;
}

.access-denied-content h1 {
    color: #fff;
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.access-denied-content p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
}

/* Loading State */
.loading-state {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

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

/* Admin Dashboard */
.admin-dashboard {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Header */
.admin-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
}

.admin-logo i {
    color: #6366f1;
}

.admin-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    text-transform: uppercase;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.admin-email {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

/* Main Content */
.admin-main {
    padding: 2rem;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-title {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-title i {
    color: #6366f1;
}

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

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

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.users {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
}

.stat-icon.verified {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.stat-icon.recent {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

.stat-icon.monthly {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: #fff;
}

.stat-icon.applications {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
}

.stat-icon.gmail {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.stat-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

/* Users Section */
.users-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header h2 i {
    color: #6366f1;
}

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

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

.users-table th,
.users-table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.users-table th {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.02);
}

.users-table td {
    color: #fff;
    font-size: 0.875rem;
}

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

/* Checkbox column */
.checkbox-col {
    width: 40px !important;
    text-align: center !important;
}

.checkbox-col input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #6366f1;
}

.user-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #6366f1;
}

/* Selected row highlight */
.selected-row {
    background: rgba(99, 102, 241, 0.1) !important;
    border-left: 3px solid #6366f1;
}

.selected-row:hover {
    background: rgba(99, 102, 241, 0.15) !important;
}

/* Selection info in header */
.section-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.selection-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(99, 102, 241, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: #a5b4fc;
    font-size: 0.875rem;
    font-weight: 500;
}

.selection-info #selectedCount {
    font-weight: 700;
    color: #6366f1;
}

/* Selected users hint */
.selected-users-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    color: #fbbf24;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.selected-users-hint i {
    color: #f59e0b;
}

.loading-row {
    text-align: center !important;
    color: rgba(255, 255, 255, 0.6) !important;
    padding: 2rem !important;
}

.loading-row .spinner {
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Status badges in table */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge.info {
    background: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
}

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

.pagination button.active {
    background: #6366f1;
    border-color: #6366f1;
}

.pagination span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

/* Footer */
.admin-footer {
    margin-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .admin-header-right {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-main {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .users-table th,
    .users-table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Button styles (if not inherited from styles.css) */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
}

/* User Cell in Table */
.user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-icon {
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.4);
}

.user-cell-info {
    display: flex;
    flex-direction: column;
}

.user-cell-name {
    font-weight: 500;
    color: #fff;
}

.user-cell-email {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Additional badge styles */
.badge.google {
    background: linear-gradient(135deg, rgba(234, 67, 53, 0.2), rgba(251, 188, 5, 0.2));
    color: #ea4335;
}

.badge.email {
    background: rgba(99, 102, 241, 0.2);
    color: #6366f1;
}

.badge.muted {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: #1a1d27;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: #fff;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h2 i {
    color: #6366f1;
}

.modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 1.5rem;
}

/* User Detail Modal */
.user-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-detail-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.user-detail-avatar-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    font-size: 1.5rem;
}

.user-detail-name-section h3 {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.user-detail-name-section p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.user-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 1rem;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.detail-item label i {
    color: #6366f1;
}

.detail-value {
    color: #fff;
    font-size: 0.875rem;
}

.detail-value.mono {
    font-family: monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    word-break: break-all;
}

.gmail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Responsive for modal */
@media (max-width: 600px) {
    .user-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .user-detail-header {
        flex-direction: column;
        text-align: center;
    }
}

/* ========== BULK EMAIL SECTION ========== */
.bulk-email-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.bulk-email-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #fff;
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.form-group select {
    cursor: pointer;
}

.form-group select option {
    background: #1a1d27;
    color: #fff;
}

.recipient-count {
    flex: 0 0 auto;
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    color: #6366f1;
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    min-width: 120px;
}

.char-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 0.5rem;
}

.email-result {
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-top: 1rem;
}

.email-result.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

.email-result.warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.email-result.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Email Preview Modal */
.email-preview-modal {
    max-width: 700px;
}

.preview-email-container {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.preview-header {
    background: #f3f4f6;
    padding: 1rem;
    color: #374151;
    font-size: 0.875rem;
    border-bottom: 1px solid #e5e7eb;
}

.preview-header strong {
    color: #6b7280;
}

.preview-body {
    padding: 1.5rem;
    color: #374151;
    font-size: 0.9375rem;
    line-height: 1.7;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
}

.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .recipient-count {
        flex: 1;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
