/**
 * Base Layout CSS
 * 
 * Main entry point for FreeconomyToday layout system
 * Imports all core CSS files in the correct cascade order
 * 
 * @package FreeconomyToday
 * @subpackage CSS\Layout
 * @version 1.0
 */

/* ==========================================================================
   CSS Architecture Overview
   ========================================================================== */
/*
 * This file establishes the CSS architecture for the FreeconomyToday layout system:
 * 
 * 1. Core Foundation (variables, reset, typography, animations)
 * 2. Layout Systems (grid, responsive utilities)
 * 3. Components (navigation, headers, footers, etc.)
 * 4. Theme Overrides (user-type specific styles)
 * 
 * Order matters! Each layer builds upon the previous layers.
 */

/* ==========================================================================
   1. Core Foundation Layer
   ========================================================================== */

/* CSS Custom Properties & Design System */
@import url('./core/variables.css');

/* CSS Reset & Normalize */
@import url('./core/reset.css');

/* Typography System */
@import url('./core/typography.css');

/* Animation System */
@import url('./core/animations.css');

/* ==========================================================================
   2. Layout Systems Layer
   ========================================================================== */

/* Grid System & Layout Utilities */
@import url('./layouts/grid.css');

/* Responsive Design Utilities */
@import url('./layouts/responsive.css');

/* General Layout Utilities */
@import url('./layouts/utilities.css');

/* ==========================================================================
   3. Components Layer
   ========================================================================== */

/* Navigation Components */
@import url('./components/navigation.css');

/* Header Components */
@import url('./components/headers.css');

/* Footer Components */
@import url('./components/footers.css');

/* ==========================================================================
   4. Theme Layer (User Type Specific)
   ========================================================================== */

/* Public Site Theme */
@import url('./themes/public.css');

/* User Dashboard Theme */
@import url('./themes/dashboard.css');

/* Admin Interface Theme */
@import url('./themes/admin.css');

/* ==========================================================================
   Global Layout Styles
   ========================================================================== */

/* Body and HTML foundation */
html {
  scroll-behavior: smooth;
  height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-primary);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background: var(--color-background);
  margin: 0;
  padding: 0;
}

/* Main content area */
main {
  flex: 1;
  min-height: 0; /* Fix for flex child overflow */
}

/* Skip link for accessibility */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-base);
  z-index: var(--z-tooltip);
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: 6px;
}

/* Focus indicators for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================================================
   Layout Structure Classes
   ========================================================================== */

/* Page wrapper */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header area */
.page-header {
  flex-shrink: 0;
}

/* Main content area */
.page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Footer area */
.page-footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* Content container */
.content-container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* Section spacing */
.section {
  padding: var(--space-8) 0;
}

.section--small {
  padding: var(--space-4) 0;
}

.section--large {
  padding: var(--space-16) 0;
}

/* ==========================================================================
   Accessibility & Print Styles
   ========================================================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
  .skip-to-content {
    background: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print optimizations */
@media print {
  .page-wrapper {
    display: block;
  }
  
  .page-header,
  .page-footer {
    position: static;
  }
  
  .skip-to-content {
    display: none;
  }
}

/* ==========================================================================
   Component Integration Utilities
   ========================================================================== */

/* Glassmorphism effect support */
.glass-effect {
  background: var(--glass-background);
  backdrop-filter: var(--glass-backdrop-filter);
  border: var(--glass-border);
}

/* User type data attribute helpers */
[data-user-type="public"] {
  --header-type: public;
  --nav-type: public;
  --footer-type: public;
}

[data-user-type="user"] {
  --header-type: app;
  --nav-type: user;
  --footer-type: app;
}

[data-user-type="admin"] {
  --header-type: app;
  --nav-type: admin;
  --footer-type: app;
}

[data-user-type="auth"] {
  --header-type: auth;
  --nav-type: minimal;
  --footer-type: legal;
}

/* Theme switching support */
[data-theme="dark"] {
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}

/* ==========================================================================
   Legacy Support & Backwards Compatibility
   ========================================================================== */

/* Support for legacy class names during migration */
.main-navigation {
  /* Styles handled by navigation.css */
}

.nav-menu {
  /* Styles handled by navigation.css */
}

.nav-link {
  /* Styles handled by navigation.css */
}

/* ==========================================================================
   Performance Optimizations
   ========================================================================== */

/* GPU acceleration for frequently animated elements */
.header,
.navigation,
.dropdown-menu,
.mobile-nav-overlay {
  will-change: transform;
}

/* Optimize font rendering */
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   End of Base Layout CSS
   ========================================================================== */

/* 
 * Note: This file serves as the main entry point for the layout system.
 * Individual components and pages should import this file to get the 
 * complete layout foundation.
 * 
 * Usage in templates:
 * <link rel="stylesheet" href="/assets/css/layout-base.css">
 * 
 * Additional page-specific CSS can be loaded after this base file.
 */