/* ============================================
   Side Menu Layout - Macy-Soft Design
   ============================================ */

:root {
    /* Primary Colors */
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    
    /* Text Colors */
    --text-primary: #333;
    --text-light: #fff;
    --text-muted: #6b7280;
    
    /* Background Colors */
    --bg-light: #f5f6fa;
    --bg-white: #ffffff;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #34495e;
    --sidebar-active: #3498db;
    
    /* Layout Dimensions */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    
    /* Transitions */
    --transition-speed: 0.3s;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.side-menu-layout {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

/* ============================================
   Layout Wrapper
   ============================================ */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--text-light);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width var(--transition-speed) ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar Header */
.sidebar-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: var(--header-height);
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: url('../android-chrome-512x512.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity var(--transition-speed);
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color var(--transition-speed);
}

.sidebar-toggle:hover {
    background-color: var(--sidebar-hover);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-list {
    list-style: none;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all var(--transition-speed);
    position: relative;
    gap: 1rem;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--text-light);
}

.nav-link.active {
    background-color: var(--sidebar-active);
    color: var(--text-light);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: var(--accent-color);
}

.nav-icon {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    transition: opacity var(--transition-speed);
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.nav-arrow {
    margin-left: auto;
    font-size: 0.875rem;
    transition: transform var(--transition-speed);
}

.sidebar.collapsed .nav-arrow {
    opacity: 0;
}

/* Submenu (updated to match design in screenshot) */
.nav-item.has-submenu .submenu-toggle.active .nav-arrow {
 transform: rotate(180deg);
}

/* Submenu container: behave like root menu (no separate background) */
.nav-submenu,
.submenu {
 list-style: none;
 max-height:0;
 overflow: hidden;
 transition: max-height var(--transition-speed) ease, padding var(--transition-speed) ease;
 padding:0;
 margin:0;
 background: transparent; /* no white panel */
 box-shadow: none; /* remove shadow */
 border-radius:0; /* same shape as root */
 width:100%;
}

/* open state: allow more height */
.nav-submenu.active,
.submenu.active {
 max-height:1000px; /* plenty of room */
 padding-top:0.25rem;
 padding-bottom:0.25rem;
}

/* Submenu items: match root .nav-link sizing and colors but indented slightly */
.nav-submenu .nav-item-link {
 display: flex;
 align-items: center;
 gap:1rem;
 padding:1.15rem1.25rem; /* increased vertical padding */
 color: rgba(255,255,255,0.92); /* similar to root links */
 text-decoration: none;
 border-radius:6px;
 margin:0.35rem0; /* more vertical spacing */
 transition: background-color var(--transition-speed), color var(--transition-speed);
 font-size:1rem; /* slightly larger */
}

/* Hover/active same as root */
.nav-submenu .nav-item-link:hover,
.nav-submenu .nav-item-link.active {
 background-color: var(--sidebar-hover);
 color: var(--text-light);
}

.nav-submenu .nav-item-icon {
 font-size:1.15rem;
 color: rgba(255,255,255,0.85);
 min-width:28px;
 text-align: center;
}

.nav-submenu .nav-item-label {
 color: rgba(255,255,255,0.92);
 font-size:1rem;
}

/* Indentation for submenu items to indicate hierarchy but keep full-width feel */
.nav-item.has-submenu > .nav-submenu {
 padding-left:0.5rem;
}

/* Ensure collapsed sidebar still hides submenus */
.sidebar.collapsed .nav-submenu,
.sidebar.collapsed .submenu {
 display: none;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.sidebar-footer .nav-link {
    padding: 0;
}

/* ============================================
   Main Wrapper
   ============================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease, width var(--transition-speed) ease;
}

.sidebar.collapsed ~ .main-wrapper {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

/* ============================================
   Top Header
   ============================================ */
.top-header {
    height: var(--header-height);
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
    padding: 0.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    padding: 2rem;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background-color: var(--primary-color);
    color: var(--text-light);
    padding: 2rem 0 1rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.8;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.footer-links a:hover {
    color: var(--secondary-color);
}

.footer-bottom {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   Mobile Overlay
   ============================================ */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .top-header {
        padding: 0 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .page-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .sidebar-header {
        padding: 0.75rem;
    }
    
    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
}