/* Default hidden states for mobile components */
.mobile-top-bar { display: none; }
.sidebar-backdrop { display: none; }

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid var(--border-color);
    padding: 0 18px 18px 18px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 64px;
    padding: 0px;
}

.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -12px;
    width: 24px;
    height: 24px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 101;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-50%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.sidebar-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* --- Main Content Area --- */
.main-content {
    margin-left: 220px;
    flex: 1;
    padding: 0 18px 18px 18px;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.sidebar-collapsed {
    margin-left: 64px;
}


/* --- Sidebar Brand & Nav --- */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-size: 1.1rem;
    font-weight: 400;
    height: var(--slim-height);
    line-height: var(--slim-height);
    margin: var(--gutter) 0 var(--gutter) 0;
    color: var(--text-muted);
    overflow: hidden;
    white-space: nowrap;
    padding: 0;
}

.brand .sl-icon {
    width: 18px;
    height: var(--slim-height);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar.collapsed .brand { justify-content: center; padding: 0; }
.sidebar.collapsed .brand .sl-icon { width: 18px !important; height: 18px !important; }
.sidebar.collapsed .brand span:not(.sl-icon) { display: none; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--text-muted);
    font-weight: 600;
    height: 32px;
    margin-bottom: 9px;
    transition: .2s;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary-light);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar.collapsed .nav-link { justify-content: center; padding: 8px 0; margin: 0 9px 9px 9px; }
.sidebar.collapsed .nav-link span:not(.sl-icon) { display: none; }

/* --- User Section --- */
.user-info {
    margin-top: auto;
    padding: 9px 18px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 9px;
    border-radius: 10px;
    transition: .2s;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-muted);
}

.user-info:hover {
    background: var(--primary-light);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar.collapsed .user-info { justify-content: center; padding: 8px 0; margin: auto 9px 0 9px; }
.sidebar.collapsed .user-details { display: none; }

.avatar {
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    font-size: 0.75rem;
    border: 1.5px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-avatar-img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.15); }
.user-name { font-weight: 700; font-size: 0.75rem; }
.user-role { font-weight: 500; font-size: 0.65rem; opacity: 0.8; }

/* --- Login Screen --- */
#login-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #64748b 0%, #0f172a 100%);
    z-index: 11000;
    backdrop-filter: blur(8px);
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    padding: 48px 40px 24px 40px;
    border-radius: 32px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
}

.simulation-divider { display: flex; align-items: center; gap: 18px; }
.divider-line { flex: 1; height: 1px; background: var(--border-color); }
.divider-text { font-size: 0.75rem; font-weight: 600; color: #94a3b8; }
/* --- Mobile Responsiveness --- */
 @media (max-width: 1024px) {
      .sidebar {
          transform: translateX(-100%) !important;
          transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
          box-shadow: 10px 0 30px rgba(0,0,0,0.1);
          z-index: 10001;
          left: 0;
          top: 0;
          width: 280px;
          max-width: 80vw !important;
          background: #fff;
      }
  
      .sidebar.active {
          transform: translateX(0) !important;
      }
  
      .sidebar-backdrop {
          position: fixed;
          inset: 0;
          background: rgba(15, 23, 42, 0.4);
          backdrop-filter: blur(4px);
          z-index: 10000;
          display: none;
          animation: fadeIn 0.3s ease-out;
      }
  
      .sidebar.active ~ .sidebar-backdrop,
      .sidebar-backdrop.active {
          display: block;
      }
  
      .main-content {
          margin-left: 0 !important;
          padding: 0 12px 0 12px; /* Remove bottom padding to fit card to edge */
          height: 100dvh; /* Use dynamic viewport height */
          display: flex;
          flex-direction: column;
      }
  
      .sidebar-toggle {
          display: flex !important;
          top: 10px;
          right: -15px;
          background: #fff;
          border: 1px solid var(--border-color);
          box-shadow: 4px 0 10px rgba(0,0,0,0.05);
      }
 
      .mobile-top-bar {
        display: flex;
        align-items: center;
        gap: 18px;
        padding: 9px 18px;
        background: #fff;
        border-bottom: 1px solid var(--border-color);
        margin: 0 -18px 18px -18px;
        height: 54px;
          position: sticky;
          top: 0;
          z-index: 90;
      }
  
      .mobile-menu-btn {
          background: none;
          border: 1px solid var(--border-color);
          border-radius: 8px;
          width: 36px;
          height: 36px;
          display: flex;
          align-items: center;
          justify-content: center;
          color: var(--text-muted);
          cursor: pointer;
      }
  
      .mobile-brand {
        display: flex;
        align-items: center;
        gap: 18px;
        font-weight: 400;
        font-size: 0.9rem;
        color: var(--text-muted);
    }  }
  }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  /* Smartphone Layout Specific Modifications */
  @media (max-width: 480px) {
      .login-card {
          padding: 32px 20px 20px 20px !important;
          border-radius: 20px !important;
          width: calc(100% - 24px) !important;
          margin: 12px auto !important;
      }
      .login-card .flex-center-gap {
        flex-direction: column !important;
        gap: 9px !important;
        width: 100% !important;
    }  }
      .login-card .google-btn-sm {
          width: 100% !important;
          margin: 0 !important;
          padding: 10px 12px !important;
          height: 40px !important;
      }
      .login-card .google-btn-blue {
          padding: 12px !important;
          height: 44px !important;
          font-size: 0.85rem !important;
      }
  }
