/* Admin Module Styles */

/* Dialog Modal Styles */
dialog.modal {
    display: none;
}

dialog.modal[open] {
    display: flex;
    flex-direction: column;
}

/* Admin Layout */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100%;
    min-height: 0;
    background: var(--bg, var(--bg-primary, #0a0a0f));
    color: var(--text, var(--text-primary, #ffffff));
}

/* Sidebar */
.admin-sidebar {
    background: var(--surface, var(--bg-secondary, #12121a));
    border-right: 1px solid var(--border, #2a2a3a);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
}

.admin-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 16px;
}

.admin-header svg {
    color: var(--primary);
}

.admin-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.admin-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.admin-nav .nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

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

.admin-nav .nav-item svg {
    flex-shrink: 0;
}

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

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

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

/* Main Content */
.admin-main {
    padding: 24px;
    overflow-y: auto;
}

/* Dashboard View */
.dashboard-view {
    max-width: 1400px;
    margin: 0 auto;
}

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

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.page-header .subtitle {
    color: var(--text-secondary);
    margin: 0;
}

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.users {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}
.stat-icon.groups {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}
.stat-icon.bots {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}
.stat-icon.storage {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

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

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Sections */
.section {
    margin-bottom: 32px;
}

.section h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px 0;
}

/* Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text);
}

.action-card:hover {
    border-color: var(--primary);
    background: var(--surface-hover);
}

.action-card svg {
    color: var(--primary);
}

.action-card span {
    font-size: 14px;
    font-weight: 500;
}

/* Activity List */
.activity-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

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

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 14px;
}

.activity-text strong {
    font-weight: 600;
}

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

/* Health Grid */
.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.health-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

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

.health-card-title {
    font-size: 14px;
    font-weight: 500;
}

.health-status {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.health-status.healthy {
    background: #10b981;
}
.health-status.warning {
    background: #f59e0b;
}
.health-status.error {
    background: #ef4444;
}

.health-value {
    font-size: 24px;
    font-weight: 700;
}

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

/* Modal Styles */
.modal {
    padding: 0;
    border: none;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 480px;
    width: 90%;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    padding: 0;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.modal form {
    padding: 24px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface-hover);
    border-radius: 0 0 16px 16px;
}

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

.btn-primary:hover {
    opacity: 0.9;
}

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

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

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--text-secondary);
}

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

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

/* Responsive */
@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: fixed;
        left: -260px;
        top: 56px;
        z-index: 100;
        transition: left 0.3s;
    }

    .admin-sidebar.open {
        left: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
