// Layout wrapper
.layout-wrapper {
  display: flex;
  min-height: 100vh;
  min-width: 600px;
  background-color: var(--surface-ground);
  color: var(--text-color);
  font-family: var(--font-family);
  
  // Layout main container
  .layout-main {
    display: flex;
    flex: 1;
    overflow: hidden;
  }
}

// Animation keyframes (logo-glow and heart-pulse moved to sidebar-content component)

@keyframes pulse-heart {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes star-pulse {
  0% { filter: drop-shadow(0 0 2px rgba(255, 215, 0, 0.4)); }
  100% { filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8)); }
}

// Content area styling
.layout-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  background-color: var(--surface-ground);
  
  // Top bar styling
  .top-bar {
    height: 60px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 0 20px;
    background-color: var(--surface-card);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 5;
    
    .top-color-line {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 3px;
      background: var(--primary-color);
    }
    
    .topbar-section {
      display: flex;
      align-items: center;
      
      &.left {
        justify-self: start;
        
        .sidebar-toggle-mobile {
          margin-right: 15px;
          width: 36px;
          height: 36px;
          display: none;
          align-items: center;
          justify-content: center;
          color: var(--text-color-secondary);
          
          @media (max-width: 768px) {
            display: flex;
          }
        }
        
        .page-title {
          font-size: 18px;
          font-weight: 600;
          color: var(--text-color);
          margin-left: 10px;
        }
      }
      
      &.center {
        justify-content: center;
        justify-self: center;
        
        .version-bar {
          display: flex;
          align-items: center;
          background-color: var(--surface-section);
          border-radius: 15px;
          padding: 2px 5px;
          border: 1px solid var(--surface-border);
          
          .version-item {
            display: flex;
            align-items: center;
            margin: 0 5px;
            
            .version-icon {
              margin-right: 5px;
              font-size: 14px;
              color: var(--primary-color);
            }
            
            .version-text {
              font-size: 12px;
              font-weight: 500;
            }
          }
          
          .github-stars {
            display: flex;
            align-items: center;
            margin-left: 10px;
            
            .star-icon {
              color: gold;
              margin-right: 5px;
              animation: star-pulse 2s infinite alternate;
            }
            
            .star-count {
              font-size: 12px;
              font-weight: 500;
            }
          }
        }
      }
      
      &.right {
        justify-content: flex-end;
        justify-self: end;

        .topbar-spacer {
          width: 36px;
          height: 36px;
          flex-shrink: 0;
        }
      }
    }
  }
  
  // Main content area
  .layout-content-inner {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    
    // Add some depth to cards and containers inside the content area
    ::ng-deep {
      .p-card,
      .p-panel,
      .p-fieldset {
        border: 1px solid var(--surface-border);
        border-radius: var(--border-radius);
        transition: transform 0.2s, box-shadow 0.2s;
        
        &:hover {
          transform: translateY(-2px);
          box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
      }
    }
  }
}

// Deep styling overrides for PrimeNG components
:host ::ng-deep {
  // Override Prime NG button styles
  .p-button {
    &.p-button-text {
      color: var(--text-color-secondary);
      
      &:hover {
        background-color: var(--surface-hover);
        color: var(--text-color);
      }
    }
  }
  
  // Card component styling
  .p-card {
    background-color: var(--surface-card);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius);
    
    .p-card-title {
      color: var(--text-color);
    }
    
    .p-card-content {
      color: var(--text-color-secondary);
    }
  }
}

// Main layout
.layout-main {
  display: flex;
  flex: 1;

  // Sidebar container - all styling moved to sidebar-content component
  // The sidebar-content component now handles all visual styling via :host selector

  // Sidebar navigation styles moved to sidebar-content component

  // Content area
  .layout-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #120b1b; // Deep purple background
    color: #ffffff;
    overflow-x: hidden;

    // Top bar styling
    .top-bar {
      height: 35px;
      background: linear-gradient(135deg, rgba(30, 18, 48, 0.95) 0%, rgba(22, 13, 35, 0.95) 50%, rgba(26, 16, 42, 0.95) 100%);
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      padding: 0 20px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
      border-bottom: 1px solid rgba(142, 68, 173, 0.15);
      position: sticky;
      top: 0;
      z-index: 100;
      position: relative;
      transition: all 0.3s ease;
      backdrop-filter: blur(5px); // Add subtle blur effect for depth

      // Top color line
      .top-color-line {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, rgba(142, 68, 173, 0.6), rgba(103, 58, 183, 0.6)); // Purple gradient
        z-index: 2;
        box-shadow: 0 0 8px rgba(142, 68, 173, 0.4); // Add subtle glow
      }

      // Add subtle colored accent to the bottom of the top bar
      &::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg, rgba(142, 68, 173, 0.6), rgba(103, 58, 183, 0.6)); // Purple gradient
        z-index: 1;
      }

      .topbar-section {
        display: flex;
        align-items: center;

        &.left {
          justify-content: flex-start;
          justify-self: start;

          .sidebar-toggle-mobile {
            display: none;
            margin-right: 1rem;
            color: #ffffff;
            background: none;
            border: none;
            padding: 0.25rem;
            font-size: 1.2rem;

            @media (max-width: 991px) {
              display: inline-flex;
            }

            &:hover {
              color: rgba(142, 68, 173, 0.8);
            }
          }
        }

        &.center {
          justify-content: center;
          align-items: center;
          display: flex;
          position: static;
          left: unset;
          transform: unset;
          width: auto;
          justify-self: center;
        }

        &.right {
          justify-content: flex-end;
          justify-self: end;

          .topbar-spacer {
            width: 36px;
            height: 36px;
            flex-shrink: 0;
          }
        }
      }

      // Page title styling
      .page-title {
        font-size: 16px;
        font-weight: 600;
        color: #ffffff;
        text-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
        letter-spacing: 0.5px;
      }

      // Version bar styling
      .version-bar {
        display: flex;
        align-items: center;
        gap: 8px;
        white-space: nowrap;
        background: rgba(26, 16, 42, 0.4);
        border-radius: 6px;
        padding: 4px 10px;
        box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(142, 68, 173, 0.15);
      }

      .version-item {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        color: #e0e6ed;
        transition: all 0.2s ease;

        &:hover {
          transform: translateY(-1px);
        }
      }

      .version-divider {
        width: 1px;
        height: 14px;
        background-color: rgba(142, 68, 173, 0.3);
      }

      .version-icon {
        color: #8e44ad;
        font-size: 13px;
        filter: drop-shadow(0 0 2px rgba(142, 68, 173, 0.4));
      }

      .star-icon {
        color: #ffd700;
        animation: star-pulse 3s infinite alternate;
      }

      .version-bar a {
        color: #9b59b6;
        text-decoration: none;
        font-weight: 600;
        transition: all 0.2s ease;
        position: relative;

        &::after {
          content: '';
          position: absolute;
          width: 0;
          height: 1px;
          bottom: -1px;
          left: 0;
          background-color: #9b59b6;
          transition: width 0.3s ease;
        }

        &:hover {
          color: #a569bd;

          &::after {
            width: 100%;
          }
        }
      }

      .developer-credit {
        color: #e0e6ed;
      }

      .developer-credit a {
        color: #9b59b6;
        font-weight: 600;
      }

      // User info styling
      .user-info {
        display: flex;
        align-items: center;
        gap: 8px;
        background: rgba(26, 16, 42, 0.4);
        border-radius: 6px;
        padding: 4px 10px;
        box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(142, 68, 173, 0.15);
        transition: all 0.2s ease;

        &:hover {
          background: rgba(25, 15, 40, 0.6);
        }

        #username {
          font-weight: 600;
          color: #e0e6ed;
          font-size: 13px;
        }

        .logout-btn {
          color: #e74c3c;
          transition: all 0.2s ease;
          opacity: 0.8;

          &:hover {
            color: #ff6b6b;
            opacity: 1;
            transform: scale(1.1);
          }
        }
      }

      // Responsive styling for topbar
      @media (max-width: 768px) {
        height: 50px;
        grid-template-columns: auto 1fr;
        align-items: center;
        padding: 0 10px;

        .top-color-line {
          width: 100%;
        }

        .topbar-section {
          align-items: center;

          &.left {
            margin-right: 10px;
          }

          &.center {
            justify-content: center;
          }

          &.right {
            display: none;
          }
        }

        .version-bar {
          margin: 0 auto;
        }
      }
    }

    // Main content area
    .layout-content-inner {
      flex: 1;
      padding: 1.5rem;
      overflow-y: auto;
      background-color: #120b1b;
      background-image: radial-gradient(circle at 50% 50%, rgba(142, 68, 173, 0.05) 0%, rgba(0, 0, 0, 0) 70%);
      position: relative;

      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: linear-gradient(90deg,
            rgba(142, 68, 173, 0),
            rgba(142, 68, 173, 0.2),
            rgba(142, 68, 173, 0));
        opacity: 0.5;
      }

      // Add some depth to cards and containers inside the content area
      ::ng-deep {

        .p-card,
        .p-panel,
        .p-fieldset {
          background: rgba(30, 18, 48, 0.4);
          border: 1px solid rgba(142, 68, 173, 0.15);
          box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
          border-radius: 8px;
          backdrop-filter: blur(5px);

          .p-card-title,
          .p-panel-header,
          .p-fieldset-legend {
            color: #fff;
            font-weight: 600;
            border-bottom-color: rgba(142, 68, 173, 0.2);
          }

          &:hover {
            border-color: rgba(142, 68, 173, 0.3);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
            transform: translateY(-2px);
            transition: all 0.3s ease;
          }
        }
      }
    }
  }
}

/* Media queries for responsiveness */
@media screen and (max-width: 768px) {
  .layout-main {
    flex-direction: column;
  }
  
  .layout-content {
    width: 100%;
    
    .layout-content-inner {
      padding: 1rem;
    }
    
    .top-bar {
      .topbar-section {
        &.left {
          flex: 0;
        }

        &.center {
          flex: 1;
          justify-content: center;
        }

        &.right {
          display: none;
        }
      }

      .version-bar {
        margin: 0 auto;
      }
    }
  }
}