/**
 * BFS Portal - Portal-Specific Styles
 *
 * This file contains only BFS Portal-specific styles.
 * Common styles are in bfs-theme.css
 */

/* ==========================================================================
   GLOBAL PAGE LAYOUT FIXES
   ========================================================================== */

/* Add top margin to page content */
.container > h1:first-child,
.container > .flex:first-child,
.container > .landing-header:first-child {
    margin-top: var(--space-lg);
}

/* Ensure proper spacing between consecutive cards */
.card + .card {
    margin-top: var(--space-lg);
}

/* Grid layouts need gaps */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

@media (max-width: 900px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Cards within grids need proper spacing for stacked cards */
.grid-2 > div > .card + .card,
.grid-3 > div > .card + .card {
    margin-top: var(--space-lg);
}

/* ==========================================================================
   NAVBAR - User display styling (inherits from bfs-theme.css)
   ========================================================================== */

/* User info in navbar - BFS Portal specific */
.nav-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: white;
    font-size: 0.875rem;
    padding: 0 0.5rem;
}

.nav-user .user-name {
    font-weight: 500;
}

.nav-user .user-role {
    opacity: 0.8;
    font-size: 0.75rem;
}

/* ==========================================================================
   ADMIN NAVIGATION (Shared across all admin pages)
   ========================================================================== */

.admin-nav {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.admin-nav a {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.admin-nav a:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.admin-nav a.active {
    background: var(--bfs-blue);
    color: white;
    border-color: var(--bfs-blue);
}

/* ==========================================================================
   ADMIN DASHBOARD STYLES
   ========================================================================== */

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--bg-card);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bfs-blue);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: var(--space-xs);
}

/* ==========================================================================
   FILTERS (Shared across admin pages)
   ========================================================================== */

.filters {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    align-items: flex-end;
}

.filters .form-group {
    margin-bottom: 0;
}

/* Filter card needs bottom margin */
form.card {
    margin-bottom: var(--space-lg);
}

/* ==========================================================================
   LANDING PAGE STYLES
   ========================================================================== */

.landing-header {
    margin-bottom: var(--space-xl);
}

.landing-header h1 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

.landing-header p {
    color: var(--text-secondary);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Sidebar Layout */
.landing-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-xl);
}

@media (max-width: 900px) {
    .landing-layout {
        grid-template-columns: 1fr;
    }
}

/* Portal List */
.portal-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.portal-item {
    display: flex;
    align-items: center;
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.portal-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--bfs-blue);
    text-decoration: none;
    transform: translateY(-2px);
    background: var(--bg-hover);
}

.portal-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--bfs-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: var(--space-lg);
    flex-shrink: 0;
}

.portal-info {
    flex: 1;
}

.portal-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.portal-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.portal-arrow {
    color: var(--text-muted);
    font-size: 1.5rem;
}

/* Icon mapping */
.icon-chart-bar::before { content: "📊"; }
.icon-users::before { content: "👥"; }
.icon-server::before { content: "🖥️"; }
.icon-video::before { content: "🎬"; }

/* ==========================================================================
   PROFILE PAGE STYLES
   ========================================================================== */

.profile-header {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--bfs-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
}

.profile-info h1 {
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
}

.profile-info .role-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bfs-blue-light);
    color: var(--bfs-blue);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ==========================================================================
   CARD ENHANCEMENTS
   ========================================================================== */

/* Card headers need bottom margin */
.card-header {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Tables inside cards */
.card .table {
    margin-bottom: var(--space-md);
}

/* Buttons at bottom of cards */
.card > .btn:last-child {
    margin-top: var(--space-sm);
}

/* ==========================================================================
   FLEX UTILITIES
   ========================================================================== */

.flex {
    display: flex;
}

.flex-between {
    justify-content: space-between;
}

.flex-center {
    align-items: center;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.pagination {
    display: flex;
    gap: var(--space-xs);
    justify-content: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.pagination a,
.pagination span {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.875rem;
}

.pagination a {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination a:hover {
    background: var(--bg-secondary);
}

.pagination span.active {
    background: var(--bfs-blue);
    color: white;
}

.pagination span.disabled {
    color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 768px) {
    .nav-user {
        align-items: center;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .flex-between {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }
}

/* ==========================================================================
   FOOTER SPACING
   ========================================================================== */

/* Add buffer before footer */
main.container {
    padding-bottom: var(--space-xl);
}
