/**
 * UYI Write - Layout Styles
 * Header, sidebars, grid system
 */

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0;
    z-index: 1000;
}

.header-brand {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
    font-family: var(--font-brand);
    padding: 0 var(--spacing-lg);
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    gap: 0;
    list-style: none;
    flex: 1;
    justify-content: space-around;
    align-items: center;
    padding: 0 var(--spacing-lg);
    height: 100%;
}

.header-nav a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.header-nav a:hover {
    color: var(--text-primary);
}

/* Main Layout */
.main-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

/* Dashboard and other pages need padding for fixed header */
body:not(.auth-page) {
    padding-top: var(--header-height);
}

.dashboard-container {
    padding-top: var(--spacing-md);
}

.auth-page {
    padding-top: 0;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease;
    overflow-y: auto;
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    z-index: 100;
    padding: 0;
}

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

.sidebar-left {
    /* Left sidebar specific styles */
}

.sidebar-right {
    right: 0;
    left: auto;
    border-right: none;
    border-left: 1px solid var(--border-color);
}

.sidebar-toggle {
    position: absolute;
    bottom: var(--spacing-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--spacing-sm);
    font-size: 1rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.sidebar-left .sidebar-toggle {
    right: var(--spacing-md);
}

.sidebar-right .sidebar-toggle {
    left: var(--spacing-md);
}

.sidebar-toggle:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-right: var(--sidebar-width);
    background-color: var(--bg-tertiary);
    min-height: calc(100vh - var(--header-height));
    transition: margin 0.3s ease;
    padding-bottom: 30px; /* Space for stats bar */
}

/* Adjust for collapsed sidebars using JavaScript-based approach */
.main-layout:has(.sidebar-left.collapsed) .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.main-layout:has(.sidebar-right.collapsed) .main-content {
    margin-right: var(--sidebar-collapsed-width);
}

/* Auth Pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--bg-primary);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-xl);
}

.auth-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: var(--spacing-xl);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: var(--spacing-sm);
    text-align: center;
}

.auth-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

/* Dashboard Layout */
.dashboard-container {
    padding: var(--spacing-xl);
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-xl);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-right {
        transform: translateX(100%);
    }
    
    .sidebar-right.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        margin-right: 0;
    }
}

