/* 
 * ADMIN LAYOUT & OVERRIDES
 * Integration of new design system into admin panel
 */

/* 
   We do NOT import fonts here anymore, they are in header.php 
   We do NOT define :root variables here, they are in variables.css
*/

.admin-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--color-slate-50);
}

/* 
 * SIDEBAR LAYOUT
 * ------------------------------------------------------------------
 */
.admin-sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-slate-900);
    color: white;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-sidebar);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.admin-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 var(--space-6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
    font-size: var(--text-lg);
    font-weight: 700;
    color: white;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s;
}

.admin-sidebar.collapsed .sidebar-header h1 {
    opacity: 0;
    width: 0;
}

/* Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
    padding: var(--space-4) 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    color: var(--color-slate-400);
    text-decoration: none;
    transition: all 0.2s;
    font-size: var(--text-sm);
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--color-primary-500);
}

.nav-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s;
}

.admin-sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Sidebar Footer (Collapse Toggle) */
.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 
 * MAIN CONTENT AREA
 * ------------------------------------------------------------------
 */
.main-content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-sidebar.collapsed+.main-content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--color-slate-200);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 var(--space-6);
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    box-shadow: var(--shadow-sm);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-slate-600);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--color-primary-100);
    color: var(--color-primary-700);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Main Page Content */
.admin-main {
    padding: var(--space-6);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    animation: fadeScaleIn 0.3s ease-out;
}

@keyframes fadeScaleIn {
    from {
        opacity: 0;
        transform: scale(0.99);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

section h2 {
    font-size: var(--text-xl);
    color: var(--color-slate-800);
    margin-bottom: var(--space-6);
    border-bottom: none;
}

/* 
 * DASHBOARD WIDGETS (Stats, Activity, Actions)
 * ------------------------------------------------------------------
 */

/* Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-6);
    align-items: start;
}

/* Stats Grid */
.stats-section {
    margin-bottom: var(--space-8);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-6);
}

.stat-card {
    background: white;
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary-200);
}

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

/* Icon Variants */
.stat-icon-primary {
    background: var(--color-primary-50);
    color: var(--color-primary-600);
}

.stat-icon-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.stat-icon-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.stat-icon-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
}

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

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-slate-900);
    line-height: 1.2;
    margin-bottom: 2px;
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--color-slate-500);
    font-weight: 500;
}

/* Recent Activity Feed */
.activity-section {
    background: white;
    border: 1px solid var(--color-slate-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-8);
}

.section-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-slate-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-slate-800);
    margin: 0;
}

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-slate-50);
    transition: background-color 0.1s;
    gap: var(--space-4);
}

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

.activity-item:hover {
    background-color: var(--color-slate-50);
}

.activity-icon {
    width: 40px;
    height: 40px;
    background: var(--color-slate-100);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.activity-details {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-slate-800);
    margin: 0 0 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-meta {
    font-size: var(--text-xs);
    color: var(--color-slate-500);
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.meta-dot {
    width: 3px;
    height: 3px;
    background: var(--color-slate-300);
    border-radius: 50%;
}

.activity-actions {
    display: flex;
    gap: var(--space-2);
}

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

.action-card {
    background: white;
    border: 1px solid var(--color-slate-200);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    text-align: left;
    height: 100%;
}

.action-card:hover {
    border-color: var(--color-primary-300);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    background: var(--color-primary-50);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-title {
    font-weight: 600;
    color: var(--color-slate-800);
    font-size: var(--text-sm);
    margin-bottom: 2px;
}

.action-desc {
    font-size: var(--text-xs);
    color: var(--color-slate-500);
}

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

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: 100%;
    }

    .admin-sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content-wrapper {
        margin-left: 0 !important;
    }
}

/* 
 * UI POLISH & DETAILS
 * ------------------------------------------------------------------
 */

/* Trend Indicators */
.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-left: auto;
    /* Push to right */
}

.trend-positive {
    background: var(--color-success-bg);
    color: var(--color-success-text);
}

.trend-neutral {
    background: var(--color-slate-100);
    color: var(--color-slate-600);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    margin-bottom: var(--space-2);
}

/* Enhanced Activity Item with User Column */
.activity-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    /* Icon | Details | User | Actions */
    align-items: center;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-slate-50);
    transition: background-color 0.1s;
    gap: var(--space-4);
}

.activity-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-slate-600);
    padding: 4px 12px;
    background: var(--color-slate-50);
    border-radius: var(--radius-full);
}

.user-mini-avatar {
    width: 20px;
    height: 20px;
    background: var(--color-primary-100);
    color: var(--color-primary-700);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 2rem;
}