/* Dashboard Filter & Grid Styles */

.dashboard-header {
    margin-bottom: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: var(--spacing-sm);
    background-color: var(--surface);
    padding: var(--spacing-xs);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.admin-subtab-btn {
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-subtab-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.admin-subtab-btn:hover {
    border-color: var(--primary);
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.filter-btn:hover {
    color: var(--primary);
}

.filter-btn.active {
    background-color: var(--primary);
    color: white;
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-header > #health-dashboard-section {
        width: 100%;
        margin-bottom: 0 !important;
    }

    .filters {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .filter-btn {
        width: 100%;
        text-align: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.9rem;
    }

    .groups-grid {
        grid-template-columns: 1fr;
    }
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.group-card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.group-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background-color: var(--background);
}

/* Dark mode for card header */
.dark-mode .card-header {
    background-color: #1a1a1a;
}

.group-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1rem;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    min-width: 0;
}

.info-row i {
    width: 20px;
    text-align: center;
    color: var(--primary);
}

.progress-section {
    margin-top: 1rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

.progress-bar-bg {
    height: 8px;
    background-color: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
}

/* Devotional & Themes Containers */
.devotional-container,
.themes-browse-container {
    padding: 2rem;
}

.devotional-header,
.themes-header {
    text-align: center;
    margin-bottom: 2rem;
}

.devotional-header h2,
.themes-header h2 {
    color: var(--text-main);
    margin: 1rem 0 0.5rem 0;
}

.current-study {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary);
}

.current-study > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.current-study > div > :first-child {
    flex: 1;
    min-width: 0;
}

.sessions-grid {
    display: grid;
    gap: 1rem;
}

.session-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.session-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.session-card.completed {
    border-color: var(--success);
}

/* Admin dashboard health block */
.health-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.health-chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.health-chart-wrap {
    width: 100%;
    max-width: 280px;
    aspect-ratio: 1 / 1;
    position: relative;
}

.health-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.health-list-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: 340px;
    min-width: 0;
}

@media (max-width: 768px) {
    .health-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem !important;
    }

    .health-chart-wrap {
        max-width: 230px;
        margin: 0 auto;
    }

    .health-list-col {
        max-height: none;
        overflow: visible;
    }
}

/* Dark mode contrast fixes for Health and Alerts sections */
.dark-mode #health-dashboard-section .bg-white,
.dark #health-dashboard-section .bg-white {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

.dark-mode #health-dashboard-section .text-gray-700,
.dark #health-dashboard-section .text-gray-700 {
    color: #e5e7eb !important;
}

.dark-mode #health-dashboard-section .text-gray-500,
.dark #health-dashboard-section .text-gray-500,
.dark-mode #health-dashboard-section .text-gray-800,
.dark #health-dashboard-section .text-gray-800 {
    color: #d1d5db !important;
}

.dark-mode #health-dashboard-section [id^="list-"] > div,
.dark #health-dashboard-section [id^="list-"] > div {
    background-color: #111827 !important;
    border-color: #374151 !important;
}

.dark-mode .alerts-container .alert-card,
.dark .alerts-container .alert-card {
    background-color: #1f2937 !important;
    border-color: #374151;
}

.dark-mode .alerts-container .bg-white,
.dark .alerts-container .bg-white {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

.dark-mode .alerts-container .alert-card .bg-gray-50,
.dark .alerts-container .alert-card .bg-gray-50 {
    background-color: #111827 !important;
}

.dark-mode .alerts-container .alert-card .bg-blue-50,
.dark .alerts-container .alert-card .bg-blue-50 {
    background-color: #0f172a !important;
}

.dark-mode .alerts-container .alert-card .text-gray-700,
.dark .alerts-container .alert-card .text-gray-700,
.dark-mode .alerts-container .alert-card .text-gray-500,
.dark .alerts-container .alert-card .text-gray-500,
.dark-mode .alerts-container .alert-card .text-blue-900,
.dark .alerts-container .alert-card .text-blue-900,
.dark-mode .alerts-container .alert-card .text-gray-900,
.dark .alerts-container .alert-card .text-gray-900 {
    color: #e5e7eb !important;
}

/* Alert severity visuals + readable detail text */
.alerts-container .alert-card {
    position: relative;
}

.alert-severity-flag {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 0.7rem;
    border: 1px solid transparent;
}

.alert-severity-flag.severity-red {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-severity-flag.severity-yellow {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.alert-severity-flag.severity-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.alert-detail-label {
    color: #111827;
    font-weight: 700;
}

.alert-detail-value {
    color: #1f2937;
    font-weight: 500;
}

.alert-detail-box {
    margin-top: 0.25rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

.dark-mode .alert-detail-label,
.dark .alert-detail-label {
    color: #f3f4f6 !important;
}

.dark-mode .alert-detail-value,
.dark .alert-detail-value {
    color: #e5e7eb !important;
}

.dark-mode .alert-detail-box,
.dark .alert-detail-box {
    background: #111827;
    border-color: #374151;
}

.dark-mode .alert-severity-flag.severity-red,
.dark .alert-severity-flag.severity-red {
    background: rgba(220, 38, 38, 0.2);
    color: #fecaca;
    border-color: rgba(252, 165, 165, 0.35);
}

.dark-mode .alert-severity-flag.severity-yellow,
.dark .alert-severity-flag.severity-yellow {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
    border-color: rgba(253, 224, 71, 0.35);
}

.dark-mode .alert-severity-flag.severity-info,
.dark .alert-severity-flag.severity-info {
    background: rgba(59, 130, 246, 0.2);
    color: #bfdbfe;
    border-color: rgba(147, 197, 253, 0.35);
}

.dark-mode #dashboard-admin-alerts .bg-white,
.dark #dashboard-admin-alerts .bg-white {
    background-color: #1f2937 !important;
    border-color: #374151 !important;
}

.dark-mode #dashboard-admin-alerts .text-gray-800,
.dark #dashboard-admin-alerts .text-gray-800,
.dark-mode #dashboard-admin-alerts .text-gray-500,
.dark #dashboard-admin-alerts .text-gray-500 {
    color: #e5e7eb !important;
}
