/**
 * Admin Panel Styles
 */

.admin-main {
    padding-top: 80px;
    min-height: calc(100vh - 200px);
    background: var(--light-bg);
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

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

.admin-header h1 {
    color: var(--text-dark);
    margin: 0 0 8px;
}

.admin-header p {
    color: var(--text-light);
    margin: 0;
}

/* Loading State */
.admin-loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid var(--light-bg);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

/* Error State */
.admin-error {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.admin-error h3 {
    color: #dc2626;
    margin: 0 0 8px;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.stat-card.stat-pending {
    border-left-color: #f59e0b;
}

.stat-card.stat-active {
    border-left-color: #10b981;
}

.stat-card.stat-disabled {
    border-left-color: #6b7280;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 4px;
}

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

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: white;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.admin-tab {
    flex: 1;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.admin-tab:hover {
    background: var(--light-bg);
    color: var(--text-dark);
}

.admin-tab.active {
    background: var(--primary-color);
    color: white;
}

.badge {
    background: white;
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.admin-tab.active .badge {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Admin Sections */
.admin-section {
    display: none;
}

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

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

.section-header h2 {
    margin: 0;
    color: var(--text-dark);
    font-size: 20px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-sm svg {
    vertical-align: middle;
}

.search-input {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    width: 250px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
}

/* User List */
.user-list {
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

/* User Card */
.user-card {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    gap: 16px;
}

.user-card:last-child {
    border-bottom: none;
}

.user-card:hover {
    background: #fafafa;
}

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

.user-info {
    flex: 1;
    min-width: 0;
}

.user-email {
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
}

.user-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.group-tag {
    background: var(--light-bg);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.user-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

.user-status.pending {
    background: #fef3c7;
    color: #b45309;
}

.user-status.active {
    background: #dcfce7;
    color: #15803d;
}

.user-status.disabled {
    background: #f3f4f6;
    color: #6b7280;
}

.user-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--light-bg);
    color: var(--primary-color);
}

.btn-icon.danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

.btn-icon.success:hover {
    background: #f0fdf4;
    color: #16a34a;
}

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

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--hover-shadow);
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-dark);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f1f5f9;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    border-radius: 0 0 16px 16px;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.checkbox-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.checkbox-label {
    flex: 1;
}

.checkbox-label strong {
    display: block;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.checkbox-label span {
    font-size: 12px;
    color: var(--text-light);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 8px;
}

.user-menu-trigger:hover {
    background: rgba(233,30,99,0.1);
}

.user-menu-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: 14px;
}

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

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--hover-shadow);
    min-width: 200px;
    display: none;
    z-index: 100;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-dark);
    text-decoration: none;
    transition: background 0.2s;
}

.user-menu-item:hover {
    background: #f8fafc;
}

.user-menu-item.logout {
    color: #dc2626;
    border-top: 1px solid #f1f5f9;
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .search-input {
        width: 100%;
    }

    .user-card {
        flex-wrap: wrap;
    }

    .user-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
    }
}
