/**
 * Layout - Pixel Style
 * Navigation, sidebar, grid system, and page layouts
 */

/* ==================== CONTAINER ==================== */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--space-lg);
}

/* ==================== NAVBAR - PIXEL STYLE ==================== */

.navbar {
    position: sticky;
    top: 0;
    z-index: var(--z-fixed);
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    height: var(--header-height);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
}

.navbar-brand .logo {
    width: 36px;
    height: 36px;
}

.navbar-brand .logo-text {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--primary-light);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    text-decoration: none;
    border-radius: 0;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

.nav-link.active {
    color: var(--primary-light);
    background: var(--primary-100);
    border-color: var(--primary-200);
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.username {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: var(--text-xs);
    transition: transform var(--transition-fast);
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Mobile Menu */
.mobile-menu-toggle {
    display: none;
}

.mobile-menu {
    display: none;
    padding: var(--space-md);
    background: var(--bg-card);
    border-top: 2px solid var(--border);
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.mobile-nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

@media (max-width: 768px) {
    .navbar-menu {
        display: none;
    }
    
    .navbar-actions .btn:not(.mobile-menu-toggle):not(.btn-icon) {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu.active {
        display: block;
    }
    
    .username {
        display: none;
    }
}

/* ==================== SIDEBAR - PIXEL STYLE ==================== */

.sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 2px solid var(--border);
    overflow-y: auto;
    z-index: var(--z-sticky);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-lg);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 0;
    background: var(--primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-xl);
    border: 2px solid var(--primary-dark);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: var(--font-bold);
    color: var(--text-primary);
}

.user-email {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.sidebar-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-item {
    text-align: center;
    padding: var(--space-md);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: 0;
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--primary-light);
}

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

.sidebar-nav {
    flex: 1;
}

.nav-section {
    margin-bottom: var(--space-lg);
}

.nav-section-title {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    padding: 0 var(--space-sm);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    text-decoration: none;
    border-radius: 0;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-xs);
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

.sidebar-link.active {
    color: var(--primary-light);
    background: var(--primary-100);
    border-color: var(--primary-200);
}

.sidebar-link .badge {
    margin-left: auto;
}

.sidebar-ca-providers {
    margin-top: auto;
    padding-top: var(--space-lg);
    border-top: 2px solid var(--border);
}

.ca-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.ca-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-decoration: none;
    border-radius: 0;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
}

.ca-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

.ca-dot {
    width: 10px;
    height: 10px;
    border-radius: 0;
    border: 2px solid;
}

/* ==================== MAIN CONTENT ==================== */

.main-content {
    min-height: calc(100vh - var(--header-height));
}

.main-content.with-sidebar {
    margin-left: var(--sidebar-width);
    padding: var(--space-xl);
}

@media (max-width: 768px) {
    .main-content.with-sidebar {
        margin-left: 0;
    }
}

/* ==================== PAGE HEADER ==================== */

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

.page-title {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-xs);
}

.page-subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

@media (max-width: 768px) {
    .page-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-actions .btn {
        width: 100%;
    }
}

/* ==================== GRID SYSTEM ==================== */

.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

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

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

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

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

.flex-auto {
    flex: auto;
}

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

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: var(--space-xs); }
.gap-2 { gap: var(--space-sm); }
.gap-3 { gap: var(--space-md); }
.gap-4 { gap: var(--space-lg); }
.gap-5 { gap: var(--space-xl); }

/* ==================== FOOTER - PIXEL STYLE ==================== */

.footer {
    background: var(--bg-card);
    border-top: 2px solid var(--border);
    padding: var(--space-3xl) 0 var(--space-xl);
    margin-top: var(--space-4xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

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

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

.footer-brand {
    max-width: 300px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: var(--font-bold);
    font-size: var(--text-xl);
    margin-bottom: var(--space-md);
}

.footer-logo img {
    width: 32px;
    height: 32px;
}

.footer-tagline {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
}

.footer-social {
    display: flex;
    gap: var(--space-sm);
}

.social-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: 0;
    color: var(--text-secondary);
    font-size: var(--text-lg);
    transition: all var(--transition-fast);
}

.social-link:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.footer-links h4 {
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary-light);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-xl);
    border-top: 2px solid var(--border);
}

@media (max-width: 768px) {
    .footer-bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}

.footer-copyright {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.footer-badge {
    display: flex;
    gap: var(--space-sm);
}

.badge-pill {
    padding: var(--space-xs) var(--space-md);
    border-radius: 0;
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    border: 2px solid;
}

.badge-free {
    background: var(--success-100);
    color: var(--success-700);
    border-color: var(--success-200);
}

.badge-ssl {
    background: var(--primary-100);
    color: var(--primary-700);
    border-color: var(--primary-200);
}

/* ==================== DASHBOARD LAYOUT ==================== */

.dashboard-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
}

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

.dashboard-content {
    padding: var(--space-xl);
    min-height: calc(100vh - var(--header-height));
}

.dashboard-section {
    margin-bottom: var(--space-xl);
}

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

.dashboard-section-title {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
}

/* ==================== AUTH PAGES - PIXEL STYLE ==================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 0;
    padding: var(--space-2xl);
    box-shadow: var(--shadow-2xl);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-lg);
}

.auth-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-xs);
}

.auth-subtitle {
    color: var(--text-secondary);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 2px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* ==================== WIZARD LAYOUT - PIXEL STYLE ==================== */

.wizard-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-xl);
}

.wizard-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.wizard-progress {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-2xl);
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.wizard-step::before {
    content: '';
    width: 80px;
    height: 4px;
    background: var(--border);
}

.wizard-step:first-child::before {
    display: none;
}

.wizard-step.active .wizard-step-number,
.wizard-step.completed .wizard-step-number {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.wizard-step-number {
    width: 32px;
    height: 32px;
    border-radius: 0;
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    background: var(--bg-card);
}

.wizard-step-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-left: var(--space-xs);
}

.wizard-step.active .wizard-step-label {
    color: var(--primary-light);
    font-weight: var(--font-bold);
}
