@use 'ui-design-system/src/styles/semantic/index' as *;

.ui-dashboard-shell {
  // Core Structure
  display: grid;
  grid-template-areas: 
    "header header"
    "sidebar main"
    "footer footer";
  grid-template-rows: auto 1fr auto;
  grid-template-columns: auto 1fr;
  position: relative;
  min-height: 100vh;
  width: 100%;
  
  // Visual Design
  background: $semantic-color-surface;
  color: $semantic-color-text-primary;
  
  // Transitions
  transition: all $semantic-motion-duration-normal $semantic-motion-easing-ease;
  
  // Variant: Bordered
  &--bordered {
    .ui-dashboard-shell__header {
      border-bottom: $semantic-border-width-1 solid $semantic-color-border-primary;
    }
    
    .ui-dashboard-shell__sidebar {
      border-right: $semantic-border-width-1 solid $semantic-color-border-primary;
    }
    
    .ui-dashboard-shell__footer {
      border-top: $semantic-border-width-1 solid $semantic-color-border-primary;
    }
  }
  
  // Variant: Elevated
  &--elevated {
    .ui-dashboard-shell__header {
      box-shadow: $semantic-shadow-elevation-2;
      z-index: $semantic-z-index-dropdown;
    }
    
    .ui-dashboard-shell__sidebar {
      box-shadow: $semantic-shadow-elevation-3;
      background: $semantic-color-surface-elevated;
    }
    
    .ui-dashboard-shell__footer {
      box-shadow: $semantic-shadow-elevation-1;
    }
  }
  
  // Sidebar collapsed state
  &--sidebar-collapsed {
    .ui-dashboard-shell__sidebar {
      &--sm, &--md, &--lg {
        width: 60px;
        min-width: 60px;
      }
    }
  }
  
  // No footer variant
  &--no-footer {
    grid-template-areas: 
      "header header"
      "sidebar main";
    grid-template-rows: auto 1fr;
  }
  
  // Mobile menu open state
  &--mobile-menu-open {
    .ui-dashboard-shell__sidebar {
      transform: translateX(0);
    }
  }
  
  // Header Element
  &__header {
    grid-area: header;
    display: flex;
    align-items: center;
    position: relative;
    z-index: $semantic-z-index-dropdown;
    
    // Layout & Spacing
    padding: 0 $semantic-spacing-component-md;
    gap: $semantic-spacing-component-md;
    
    // Visual Design
    background: $semantic-color-surface-secondary;
    border-bottom: $semantic-border-width-1 solid $semantic-color-border-secondary;
    
    // Typography
    font-family: map-get($semantic-typography-body-medium, font-family);
    font-size: map-get($semantic-typography-body-medium, font-size);
    font-weight: map-get($semantic-typography-body-medium, font-weight);
    line-height: map-get($semantic-typography-body-medium, line-height);
    
    // Height variants
    &--sm {
      min-height: $semantic-sizing-input-height-sm;
      padding: 0 $semantic-spacing-component-sm;
    }
    
    &--md {
      min-height: $semantic-sizing-input-height-md;
      padding: 0 $semantic-spacing-component-md;
    }
    
    &--lg {
      min-height: $semantic-sizing-input-height-lg;
      padding: 0 $semantic-spacing-component-lg;
    }
  }
  
  // Mobile Toggle Button
  &__mobile-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    
    // Layout & Spacing  
    width: $semantic-sizing-touch-target;
    height: $semantic-sizing-touch-target;
    padding: $semantic-spacing-component-xs;
    margin-right: $semantic-spacing-component-sm;
    
    // Visual Design
    background: transparent;
    border: none;
    border-radius: $semantic-border-radius-sm;
    color: $semantic-color-text-primary;
    cursor: pointer;
    
    // Typography
    font-family: map-get($semantic-typography-button-medium, font-family);
    font-size: map-get($semantic-typography-button-medium, font-size);
    font-weight: map-get($semantic-typography-button-medium, font-weight);
    line-height: map-get($semantic-typography-button-medium, line-height);
    
    // Transitions
    transition: all $semantic-motion-duration-fast $semantic-motion-easing-ease;
    
    // Interactive States
    &:hover {
      background: $semantic-color-surface-elevated;
    }
    
    &:focus-visible {
      outline: 2px solid $semantic-color-focus;
      outline-offset: 2px;
    }
    
    &:active {
      background: $semantic-color-surface-container;
    }
    
    &-icon {
      display: block;
      font-size: $semantic-typography-font-size-lg;
    }
  }
  
  // Header Content
  &__header-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: $semantic-spacing-component-sm;
  }
  
  // Header Actions
  &__header-actions {
    display: flex;
    align-items: center;
    gap: $semantic-spacing-component-sm;
  }
  
  // Container for Sidebar and Main
  &__container {
    grid-area: sidebar / sidebar / main / main;
    display: contents;
  }
  
  // Sidebar Element
  &__sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: $semantic-z-index-dropdown;
    
    // Layout & Spacing
    padding: $semantic-spacing-component-md;
    
    // Visual Design
    background: $semantic-color-surface-secondary;
    border-right: $semantic-border-width-1 solid $semantic-color-border-secondary;
    
    // Typography
    font-family: map-get($semantic-typography-body-medium, font-family);
    font-size: map-get($semantic-typography-body-medium, font-size);
    font-weight: map-get($semantic-typography-body-medium, font-weight);
    line-height: map-get($semantic-typography-body-medium, line-height);
    
    // Transitions
    transition: all $semantic-motion-duration-normal $semantic-motion-easing-ease;
    
    // Width variants
    &--sm {
      width: 200px;
      min-width: 200px;
    }
    
    &--md {
      width: 280px;
      min-width: 280px;
    }
    
    &--lg {
      width: 360px;
      min-width: 360px;
    }
    
    // Collapsed state
    &--collapsed {
      padding: $semantic-spacing-component-sm;
      overflow: hidden;
    }
  }
  
  // Mobile Backdrop
  &__mobile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: $semantic-z-index-overlay;
    
    // Visual Design
    background: $semantic-color-backdrop;
    opacity: $semantic-opacity-backdrop;
    
    // Transitions
    transition: opacity $semantic-motion-duration-fast $semantic-motion-easing-ease;
    
    // Interactive
    cursor: pointer;
  }
  
  // Main Content Element
  &__main {
    grid-area: main;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    
    // Layout & Spacing
    padding: $semantic-spacing-component-md;
    
    // Visual Design
    background: $semantic-color-surface;
    color: $semantic-color-text-primary;
    
    // Typography
    font-family: map-get($semantic-typography-body-medium, font-family);
    font-size: map-get($semantic-typography-body-medium, font-size);
    font-weight: map-get($semantic-typography-body-medium, font-weight);
    line-height: map-get($semantic-typography-body-medium, line-height);
  }
  
  // Breadcrumbs Element
  &__breadcrumbs {
    padding-bottom: $semantic-spacing-component-sm;
    margin-bottom: $semantic-spacing-component-md;
    border-bottom: $semantic-border-width-1 solid $semantic-color-border-subtle;
    
    // Typography
    font-family: map-get($semantic-typography-body-small, font-family);
    font-size: map-get($semantic-typography-body-small, font-size);
    font-weight: map-get($semantic-typography-body-small, font-weight);
    line-height: map-get($semantic-typography-body-small, line-height);
    color: $semantic-color-text-secondary;
  }
  
  // Notifications Element
  &__notifications {
    margin-bottom: $semantic-spacing-component-md;
    padding: $semantic-spacing-component-sm;
    background: $semantic-color-surface-container;
    border-radius: $semantic-border-radius-md;
    border: $semantic-border-width-1 solid $semantic-color-border-subtle;
  }
  
  // Content Element
  &__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  
  // Footer Element
  &__footer {
    grid-area: footer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    // Layout & Spacing
    padding: $semantic-spacing-component-md;
    
    // Visual Design
    background: $semantic-color-surface-secondary;
    border-top: $semantic-border-width-1 solid $semantic-color-border-secondary;
    
    // Typography
    font-family: map-get($semantic-typography-body-small, font-family);
    font-size: map-get($semantic-typography-body-small, font-size);
    font-weight: map-get($semantic-typography-body-small, font-weight);
    line-height: map-get($semantic-typography-body-small, line-height);
    color: $semantic-color-text-secondary;
    
    // Footer variants
    &--minimal {
      padding: $semantic-spacing-component-sm;
      font-family: map-get($semantic-typography-caption, font-family);
      font-size: map-get($semantic-typography-caption, font-size);
      font-weight: map-get($semantic-typography-caption, font-weight);
      line-height: map-get($semantic-typography-caption, line-height);
    }
    
    &--standard {
      // Default styling already applied above
    }
    
    &--detailed {
      flex-direction: column;
      align-items: flex-start;
      gap: $semantic-spacing-component-sm;
      padding: $semantic-spacing-component-lg;
    }
  }
  
  // Responsive Design - Mobile First
  @media (max-width: 768px) {
    grid-template-areas: 
      "header"
      "main"
      "footer";
    grid-template-columns: 1fr;
    
    .ui-dashboard-shell__mobile-toggle {
      display: flex;
    }
    
    .ui-dashboard-shell__sidebar {
      position: fixed;
      top: 0;
      left: 0;
      height: 100vh;
      z-index: $semantic-z-index-modal;
      transform: translateX(-100%);
      
      &--sm, &--md, &--lg {
        width: 280px;
        min-width: 280px;
      }
    }
    
    .ui-dashboard-shell__main {
      padding: $semantic-spacing-component-sm;
    }
    
    .ui-dashboard-shell__header {
      padding: 0 $semantic-spacing-component-sm;
      gap: $semantic-spacing-component-sm;
      
      &--sm, &--md, &--lg {
        min-height: $semantic-sizing-input-height-md;
        padding: 0 $semantic-spacing-component-sm;
      }
    }
    
    .ui-dashboard-shell__footer {
      padding: $semantic-spacing-component-sm;
      
      &--detailed {
        padding: $semantic-spacing-component-md;
      }
    }
  }
  
  @media (max-width: 480px) {
    .ui-dashboard-shell__main {
      padding: $semantic-spacing-component-xs;
    }
    
    .ui-dashboard-shell__header {
      padding: 0 $semantic-spacing-component-xs;
      gap: $semantic-spacing-component-xs;
      
      &--sm, &--md, &--lg {
        padding: 0 $semantic-spacing-component-xs;
      }
    }
    
    .ui-dashboard-shell__footer {
      padding: $semantic-spacing-component-xs;
      
      &--detailed {
        padding: $semantic-spacing-component-sm;
      }
    }
    
    .ui-dashboard-shell__sidebar {
      &--sm, &--md, &--lg {
        width: 100vw;
        min-width: 100vw;
      }
    }
  }
}